Answer the question
In order to leave comments, you need to log in
Is it possible to use the browser's local storage to store the state of a react application?
I came up with the idea to use local storage to store the state of the application. In theory, it can be convenient - without registration / login, the user will save the selected topic, for example. Is this approach reasonable?
Answer the question
In order to leave comments, you need to log in
There are no cons and many people do it.
For this, in general, localstorage / sessionstorage were invented.
You can’t just put any sensitive data in local storage, such as passwords, tokens, and sessions.
Yes, in general, like any cache, problems begin when it needs to be disabled. You can overwrite cookies from the server.
Well, there may still be problems if the code writes something crookedly and breaks your structure (if it exists, of course). That is, if you save an object, then you need to be prepared that it may return invalid from the storage. But these are rather problems for large applications with several developers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question