Closed mifi closed 1 year ago
Cool. It was working like that initially but I removed it while refactoring to simplify things. I don't remember why I didn't add it back again.
There are a few more things we should do to finish this task:
react-17
branchIf you don't have time for these, I can do it as well. Let me know.
Thanks for the contribution!
I don't have much time these days so if you want, feel free :)
Yeah, I'll do it. It's a nice improvement.
Done. I did all tasks and published two new releases — 18.3.0 and 17.2.0.
If you are interested in the implementation — https://github.com/astoilkov/use-local-storage-state/commit/5f558840247dd6c791bcd9ccb49dee426961775c.
I even cut a few bytes off the bundle size 🤣.
Thanks for the idea.
fantastic! thanks
First thanks for creating and maintaining this module! Looking at the docs:
I would expect something like this to work:
because that's how useState works:
Looking at the code, it uses useRef, however useRef doesn't support functional initialzier, so this PR attempts to add support for that