-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding zustand-boilerplate to third-party-libraries #2673
Conversation
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) // ... ```
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please order the list alphabetically.
Fixed it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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:
Related Bug Reports or Discussions
Fixes #
Summary
Check List
pnpm run prettier
for formatting code and docs