zustand
https://gyazo.com/26b82fad5e291bae67821369afe74c31
サンプルコード
code:js
const useStore = create((set) => ({
count: 1,
inc: () => set((state) => ({ count: state.count + 1 })),
}))
function Controls() {
const inc = useStore(state => state.inc)
return return <button onClick={inc}>one up</button>
}
function Counter() {
const count = useStore(state => state.count)
return <h1>{count}</h1>
}
teramotodaiki.icon
なんて読むんだろう。ザスタンド?