jaredpalmer / formik-persist

💾 Persist and rehydrate a Formik form to localStorage
MIT License
377 stars 56 forks source link

Introduce ability to pass custom storage as a prop. defaults to local storage. #1

Closed notgiorgi closed 6 years ago

notgiorgi commented 7 years ago

Introduce ability to pass custom storage as a prop. defaults to local storage.

I'll add docs after the review.

notgiorgi commented 7 years ago

@jaredpalmer Hi, I fixed the exports and async/await stuff.

Not sure how to proceed with

So all in all I'm not sure passing storage as a prop is a good API. I think i'd rather expose a couple of the most common persistence options as components and the a factory to make your own. So takes a prop like storage="localStorage" or storage="asyncStorage"

Should I introduce react-native as a peer dependency?

lucasbento commented 6 years ago

This is a good PR, I would go with tweaking it to work with implementing AsyncStorage in the code (as it is on LocalStorage file) and having the prop storage="asyncStorage" as per what @jaredpalmer said.

Just bumping this since it's pretty useful for me.