Zust2help - ((full))
Since zust2help isn't an official Zustand package, this feature set is inferred from common community needs around Zustand v2 (which introduced middleware types, create changes, and Immer improvements).
Common Issues & Solutions (Zustand Help)
Migration tips (from local state / Redux / Context)
- Identify domains and create one store per domain.
- Move API calls from components into services; wire those into store actions.
- Replace context consumers with store selectors incrementally.
- Add status fields and update UI to read status.
- Remove redundant state once store is authoritative (keep backup branch).
- Add unit tests for critical actions before deleting old code.
Using the Store in a Component
function Counter()
const count, increment, decrement, reset = useStore()
return (
<div>
<p>Count: count</p>
<button onClick=increment>+</button>
<button onClick=decrement>-</button>
<button onClick=reset>Reset</button>
</div>
)
zust2help
1. Automatic Middleware Wrapping
- Converts plain Zustand stores to use
devtools, persist, or immer with a single flag.
- Example:
zust2help wrap --middleware=persist,devtools ./store.js