Skip to content

Instantly share code, notes, and snippets.

@bernatfortet
Created January 13, 2020 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernatfortet/f700dfa26b96e10ef6f004f5f941add7 to your computer and use it in GitHub Desktop.
Save bernatfortet/f700dfa26b96e10ef6f004f5f941add7 to your computer and use it in GitHub Desktop.
import create, { GetFunction, SetFunction } from 'zustand'
export type MyStore = {
flag?: boolean
actions: MyActions
}
class MyActions {
constructor(public set: SetFunction<MyStore>, public get: GetFunction<MyStore>) {}
action = async () => {
}
}
export const [useAdminStore, adminApi] = create<MyStore>((set, get) => ({
flag: true,
actions: new MyActions(set, get)
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment