Installation
This section guides you through installing the library and setting up your project to use it effectively.
Installation
First, install the library in your project using your preferred package manager:
Setting Up Your Store
To start using the library, you need to create your global store. Follow these steps:
- Create a Store Begin by defining the initial state of your application and creating the store:
- Creating a Module
A module is a self-contained part of your state that can be reused across different parts of your application. It’s a great way to organize your state and make it easier to manage and update.
To create a module, use the createModule
function:
The createModule
function takes two arguments: the store and the name of the module.
- Add Middleware (Optional) Middleware allows you to extend the functionality of the store. For example, logging state changes:
- React Integration To connect the store with your React components, use the useStore hook: