-
Notifications
You must be signed in to change notification settings - Fork 40
support custom serialization/deserialization. fixes #75 #78
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
support custom serialization/deserialization. fixes #75 #78
Conversation
|
Could you please update documentation as well? |
186e8c9 to
fca9dde
Compare
Done |
polemius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add mention of converter to Usage section
fca9dde to
5056254
Compare
5056254 to
bb30931
Compare
I assume in the Usage section it makes sense to show the default but please let me know if you think something else should go there. |
I thought maybe we could show in Usage section all options like: |
|
Yeah, what I put there is import { recoilPersist } from 'recoil-persist'
const { persistAtom } = recoilPersist({
key: 'recoil-persist', // this key is using to store data in local storage
storage: localStorage, // configurate which storage will be used to store the data
converter: { // configurate how values will be serialized/deserialized in storage
parse: (value) => JSON.parse,
stringify: (value) => JSON.stringify
}
})Although |
you need to pass values to function |
|
Good job! Thank you! |
|
Released in 5.0.0 🚀 |
The solution described in #75 (comment) doesn't work (at least for my use case) because
setItemaccepts a string whereas I (and I suspect @tpict) need to control how stringify/parse actually work.