3 ms·
I already don't wanna use it when I see api like 'useLocalStorage', when does this end the spreading of this garbage hook thing? What does local storage have an
by nsonha 4y ago
I already don't wanna use it when I see api like 'useLocalStorage', when does this end the spreading of this garbage hook thing? What does local storage have anything to do with render cycle?
- DangitBobby 4y agoIt's pretty simple, conceptually. It's like useState but saves state in localStorage. It has exactly the same stuff to do with the render cycle as useState.
- nsonha 4y agono? You wanna duplicate local storage as a state in memory, and doing that you create some unnecessary hook that does the read write assuming re-renders. So now your codebase will have 2 different ways of doing localStorage, the normal, predictable way, when re-rendering isn't needed and the hook way.
- DangitBobby 4y agoOk