store.ts 313 B

123456789101112131415
  1. import { create } from 'zustand'
  2. import type { Label } from './constant'
  3. type State = {
  4. labelList: Label[]
  5. }
  6. type Action = {
  7. setLabelList: (labelList?: Label[]) => void
  8. }
  9. export const useStore = create<State & Action>(set => ({
  10. labelList: [],
  11. setLabelList: labelList => set(() => ({ labelList })),
  12. }))