mobx-store-generator
Generates React Hooks and React Context for Mobx Stores.
Includes Store persistance out of the box thanks to mobx-persist
.
Usage
1. Create your store
; ; ; // React NativeHydrateStoreAsyncStorage"UserStore", StoreImpl; // WebHydrateStorelocalStorage"UserStore", StoreImpl; ;
2. Use your store in a Functional Component using hooks
;; ; ;
3. Use your store in a Class Component using Injection
; ;
4. Add your Provider to the Root of your application
Note: You only need to do this for a single store, if you have multiple, you dont need to do it again.
UserStore.Provider App //UserStore.Provider
Thanks
- Mobx
- Mobx-React
- React
- https://github.com/pinqy520/mobx-persist