Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts/day14/ #9

Open
utterances-bot opened this issue Aug 14, 2021 · 4 comments
Open

posts/day14/ #9

utterances-bot opened this issue Aug 14, 2021 · 4 comments

Comments

@utterances-bot
Copy link

Day-14, LocalStorage need to kept in check

https://sahil-shubham.in/posts/day14/

Copy link

rakaar commented Aug 14, 2021

Why did u call Local Storage as Low grade?. Its a good and the simplest way many times.

Copy link
Owner

sahil-shubham commented Aug 14, 2021

It's not that I call localStorage as "low grade" specifically, I meant it as low grade alternative to state management (kind of).

Having some data that doesn't update frequently outside of your component tree is something that can be done with localStorage (similar to having a global state), but one shouldn't simply shift to it because you cannot make other components re-render if one component changes the value in localStorage. This is other benefit of something like Redux, you can make components re-render or "subscribe" to changes in global state.

Copy link

rakaar commented Aug 15, 2021

What I feel you are missing about LocalStorage is, that in siormple cases, they can be used a "database".

All the redux state variables and all are good till the website is open. Once the site is closed, there needs to be a place where data is stored. LocalStorage is the only option then. Of course you can have a database, which is the right way. But LocalStorage solves problems in simple way!

@sahil-shubham
Copy link
Owner

Once the site is closed, there needs to be a place where data is stored.

Yep, I agree with you. There are other uses of localStorage too, some of which I have mentioned. It solves some problems on some scale, and not a complete replacement for them, hence the reason you have put database in inverted commas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants