📄️ Create Chunk
The createChunk function is the heart of mobx-chunk, allowing you to define a type-safe store slice ("chunk") with minimal boilerplate. It automatically generates actions, selectors, async actions, and loading flags based on your configuration and custom definitions.
📄️ Subscribe to Changes
mobx-chunk provides easy-to-use React hooks to reactively subscribe to store changes and keep your components in sync.
📄️ Persistence Setup
To persist store fields across sessions, mobx-chunk lets you plug in any storage engine via configurePersistenceEngine. Below are examples for React Native (MMKV, AsyncStorage) and web (localStorage).
📄️ Middleware Setup
mobx-chunk supports action interceptors—middleware functions that run before or after your custom actions and async flows. Use them to add validation, logging, performance monitoring, or any cross-cutting concerns.
📄️ withStore HOC
Use the withStore higher-order component (HOC) to create a local MobX chunk instance for a specific component or screen. The local store is automatically created when the component mounts and disposed when it unmounts.