CreateStoreOptionsType
Last updated
Last updated
Interface of the 3rd (options)
argument accepted by the createStore()
method.
log
Setting this flag will enable/disable the custom logger middleware. The logger highlights the previous state, the payload of the update and the content of the new state.
There is a known bug if you're using Flipper as it doesn't allow syntax highlighting for logs (yet).
subscribe
Setting this flag will enable/disable the new subscribeWithSelector()
middleware and make it accessible via createStore().subscribeWithSelector()
.
persist
It uses the same PersistOptions
as zustand's persist middleware with only 2 differences:
getStorage
is now required instead of optional. This is due to the fact that zustand uses LocalStorage by default when this field is not provided, which wouldn't work with React Native.
name
is now optional instead of required. This is because zfy simply uses the name
you provided as createStore()
1st argument by default. Of course, you can still override it here if need be.
The detailed API reference is available here:
customMiddlewares
This field allows you to provide middlewares to zfy. This could be one that you created yourself from scratch or a prebuilt zustand middleware that zfy doesn't already expose. Please refer to the Using middlewares guide if you want to know how to use this option.