rt2zz / unstated-persist

19 stars 4 forks source link

Any plans to make this work for React Native? #1

Closed t2 closed 6 years ago

rt2zz commented 6 years ago

rn is supported, just need to pass AsyncStorage into the persist config instead of localForage: https://github.com/rt2zz/unstated-persist#usage

t2 commented 6 years ago

@rt2zz You're right, I got lazy. The babel-preset-flow and babel-preset-env dependencies needed to be installed. Should these be in your dependencies rather than devDependencies? The .babelrc.js is expecting them.

rt2zz commented 6 years ago

ah hmm, probably we should not include babelrc in the bundle, I think that was an oversight

t2 commented 6 years ago

Those were my thoughts too I just didn't know if you had another reason.

rt2zz commented 6 years ago

updated in v0.0.3

fukhaos commented 5 years ago

@t2 Could you provide how you use AsyncStorage with unstated-persist ?

joaovpmamede commented 5 years ago

@fukhaos something like:

export default class MyContainer extends PersistContainer {
  state = {
    // my state
  };

  persist = {
    key: 'myContainer',
    version: 1,
    storage: AsyncStorage
  };
}