Have you ever spent minutes creating the perfect response only to lose it all with a misclick or accidental refresh? We often focus on optimizing p...
For further actions, you may consider blocking this person and/or reporting abuse
just did same thing here
Definitely need to include security in the considerations, as private data should never persist to local storage.
Good point, thanks I'll add it in.
🙌 nice work
Excellent article and I don't wanna highjack the comment section but what do you use for product notification in React? Like if I'm building an app in React, what are some of the tools/libraries I can use to embed notifications in my app?
You can enhance the whole process and speed, by dedicating to a web-worker to all the serialisation/deserialisation and write/read work, creating a homeMade Store (with a BehaviorSubject and a Map<> to store the data, for exemple) as a runtime cache, so you can pool the hard work (thinking at the web worker like a thread). The Web-Worker fills the cache on request, or automatically (for referenceData, like all the countries, etc ..), and you get your data from the "store", which is instant in normal conditions. Did that at work, it's working wonderfully ;) . EDIT : For security, a simple crypto algorithm is enough : localStorage is ...local, so you don't have a lot of people that will access directly to your computer/browser, and of course, you'll never persist sensitive data here : if you REALLY need to (you'll never !!), you can encrypt with an enormous key, you can use any cloud based secret-Vault to get your keys and all that. If somebody is smart enough to take the control of your working computer from an outside location, the "poorly" encrypted data that you have in your localStorage will be the least of your preoccupations :)
Why not writing simple react code without adding typescript? Not everyone understands typescript.
Because type safety is important even with simple implementations.
they should ;)
You might need to listen "storage" event and update component state accordingly, as we can always change local storage directly.
Not in this case. We are using local storage for a back up. If our main goal was to sync state between windows, I’d use something like the BroadcastChannel API.