zustand-di
use react context to init zustand stores. dependency injection for zustand with react.
A simplified patch of createContext
from zustand/context
that might be deprecated in the future. This patch removes useStoreApi
.
- This is 633 B compared to the zustand one of 831 B.
- Opinionated: forces use of selector via typescript.
Installation
npm install zustand zustand-di
Peer Dependencies
For zustand-di@0.0.7
and higher
{
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"zustand": "^4.1.0"
}
For zustand-di@0.0.6
and below
{
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"zustand": "^4.0.0"
}
Usage
See zustand docs.