astoilkov/use-local-storage-state

need guidance for using sessionStorage also

rhythmbhiwani opened this issue · 3 comments

For some of my usecase, I also need support for using sessionStorage also, but this library seems to focus only only on local-storage. Can you please guide me how can I convert it to use both local and session storage based on some parameters. I can fork the repo and change it in that repo, so that this library can focus on local storage

I'm working on a branch, that's mostly done, that will allow specifying a storage option. You can then pass sessionStorage to the option. You can take a look at it here: https://github.com/astoilkov/use-local-storage-state/tree/storage-option#optionsstorage.

I will soon post a solution for this. Thanks for the patience.

Done. I've published a use-session-storage-state package. This is the repo — https://github.com/astoilkov/use-session-storage-state.

Hope that helps. Closing this issue.