close
The Wayback Machine - https://web.archive.org/web/20220325130122/https://github.com/imbhargav5/rooks/issues/900
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

[useLocalStorageState] and [useSessionStorageState] should support replacer, reviver for JSON stringify and parsing. #900

Open
imbhargav5 opened this issue Mar 25, 2022 · 0 comments
Labels
good first issue help wanted

Comments

@imbhargav5
Copy link
Owner

@imbhargav5 imbhargav5 commented Mar 25, 2022

Is your feature request related to a problem? Please describe.
Some users require saving objects like ES6 maps which can't be JSON.stringified without a replacer function.

Describe the solution you'd like

We need replacer/ reviver functions optionally to be sent as arguments.

useLocalstorageState('key', value, {
  replacer: () => {},
  reviver: () => {} 
})

Replacer will be used by JSON.stringify and JSON.parse will use the reviver.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

What do you think?

@imbhargav5 imbhargav5 added help wanted good first issue labels Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue help wanted
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant