'In redux how to make the data non volatile
I am using redux So i have the user input their credentials and login after login I update the state but if the page refresh the data of state in lost which should not be done how can I make it non volatile the second thing I want some ui to not display If the user logged in i have google about it but the imports they are telling here are not working anymore
Solution 1:[1]
Maybe u can wrap the content u don't want to render inside Curly Braces and do a
check if you're Condition is true or false for example:
{!isNotLoggedIn ? // content you want to show : return null }
It should only display the content when the User is Not Logged in, otherwise it returns nothing. And for the other Problem, i would try to save the State in the localStorage or Session Storage. Or otherwise send it to a server.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yannick |
