1.0.3 • Published 9 months ago

kl_state v1.0.3

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

kl_state:

a simple react state manager

useage:

create store

interface BearState {
  bears: number;
  inc: () => void;
}

const useBearStore = create<BearState>((set) => ({
  bears: 0,
  inc: () =>
    set((state) => {
      state.bears++;
    }),
}));

use store

when state change the component will rerender

const {bears,inc}=useBearStore() as Pick<BearState, "bears">

use store bye select

rerender the component only the select data change

const inc=useBearStore((state)=>state.inc) as BearState["inc"]
1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

0.0.2

10 months ago

0.0.1

10 months ago