I'm wandering how to store user information after login?
Is it a good idea to store all the information in local storage or in redux store?
After successful login API return me a large object with user role and permission along with some other information.
I'm new in react-redux please help!
Thanks!
Store user information in redux store. If you want to persist it (I do not recommend it, see details in this answer bellow) after reload of the application, you can use redux-persist
.
But it really depends on what kind of authentication are you using. Generally you should use (and persist) only some authentication token (not the all user information). You can store this token in cookies and use it (for the backend request) for getting real user information (which you then store in redux store) on each application load.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With