mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Adding zustand-boilerplate to third-party-libraries (#2673)
* Adding zustand-boilerplate to third-party-libraries
Hi,
I'm the maker of zustand-boilerplate. It's a small utility that generates getters, setters based on a class representing a zustand store. I'd like to add it to the list of 3rd party libraries to let people know. I've attached an example:
```
import { create } from "zustand"
import * as Z from "zustand-boilerplate"
interface Bear {
name: string
}
class BearStore {
@Z.Boolean()
isDangerous = false
@Z.Number()
count = 0
@Z.Array()
bears: Bear[] = []
//
// Notice you have to set a default value and apply the decorator
// to properties for generated actions to work
//
@Z.Any()
mainBear: Bear | undefined = undefined
@Z.String()
userName: string | undefined = undefined
}
const bearStoreWithActions = Z.generateStoreWithActions(BearStore)
export const store = create(bearStoreWithActions)
// The following will automatically work now (fully typed)
// store.getState().getBears() -> Bear[]
// store.getState().setBears(bears)
// ...
```
* chore: a-z ordering
This commit is contained in:
parent
4c5cb7c6cc
commit
69112dcfff
@ -37,6 +37,7 @@ This can be done using third-party libraries created by the community.
|
||||
- [zukeeper](https://github.com/oslabs-beta/Zukeeper) - Native devtools with state and action tracking, diffing, tree display, and time travel
|
||||
- [zundo](https://github.com/charkour/zundo) — 🍜 Undo and redo middleware for Zustand, enabling time-travel in your apps.
|
||||
- [zustand-ards](https://github.com/ivoilic/zustand-ards) - 💁 Simple opinionated utilities for example alternative selector formats and default shallow hooks
|
||||
- [zustand-boilerplate](https://github.com/sagiereder/zustand-boilerplate) - A tool that automatically generates getters, setters and more for your zustand store.
|
||||
- [zustand-computed](https://github.com/chrisvander/zustand-computed) — A Zustand middleware to create computed states.
|
||||
- [zustand-computed-state](https://github.com/yasintz/zustand-computed-state) — Simple middleware to add computed states.
|
||||
- [zustand-constate](https://github.com/ntvinhit/zustand-constate) — Context-based state management based on Zustand and taking ideas from Constate.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user