Let See Redux Persist

Zain Ahmed
2 min readSep 5, 2020

--

Now we see earlier what is redux , in this artical we will see what is redux persist

in simple words persist is what ,when data is store and set same as old when you refresh your browser, but the question is here why and how.

let see first why

let say you have a website portal admin panel and you login to this portal so you are doing some editing and inserting and for some reason you browser get refresh or any api break. so your Auth data which was in redux store got refresh and set to initial state in that case you have to login again , and that’s where the problem begin you have to login again ,fill form again and make request again ,

redux persist come here to help you that if your are setting forms data to redux store and you also integrate redux persist on your store then no need to worry , when you browser get refresh no data loss will happens ,

let see how

so when you refresh your browser the redux just did a simple trick it save you store data to local storage of you browser for a small time as far as your tab is loading and when the refresh done it takes data from local storage and save it in redux store , and null the local storage variable , simply

Implementation

persist file

you have to download redux persist library and then import some feature and then create persistconfig with any name ,

so what is black and white list

suppose you have a application having feature of save credit card info or any sensitive so you have to define the reducer state in black list so if your application got kill the data will vanish it will set to initial state for safety

but if you dont want to do vanish then place the reducer state in white list , so that state will not set to its initial for that reducers

you can config redux with my previous artical and then you can see persist config here

you can also follow me on my youtube channel , there’s alot stuff on my youtube channel also

--

--

Zain Ahmed
Zain Ahmed

Written by Zain Ahmed

Hello everyone, I am Zain Anmed a software engineer by profession, passionate about trying different technologies and trying some other cool stuff.

No responses yet