Closed siderakis closed 2 years ago
@siderakis You can pass the default value in one of the components only. The rest will automatically take up that value. This feature is available in the master branch for now.
npm install https://github.com/ammarahm-ed/react-native-mmkv-storage
At initialization you must call new MMKVStorage.Loader().withPersistedDefaultValues().initialize()
What are the pros/cons of fetching same data in different components using multiple calls to useMMKVStorage compared to passing the data/setter function as a prop from a component higher up the component tree?
I haven't tested it but making multiple calls to useMMKVStorage for the same data opens up the potential to call it with different default values. This seems like a minor reason to favor passing down the data/setters.