valtio / zustand / jotai /nanostores comparsion
叠甲: 一些个人理解, 并不是大而全的比较.
store value in
| name | store value in |
|---|---|
| valtio | in global store |
| zustand | in global store |
| nanostores | in global store |
| jotai | context level store |
例如 nanostore.atom v.s jotai.atom
1 | import { atom } from 'nanostores' |
1 | import { atom } from 'jotai' |
nanostore $counter.set可以判断 state 就是存在于$counteratom 中jotaiatom 创建的是 config, 数据存在于 context levelstore中,atom更像 store key, 所以会看到setCount需要从useAtom中获取
zustand & jotai
from jotai docs
To hold states, Both have stores that can exist either at module level or at context level. Jotai is designed to be context first, and module second. Zustand is designed to be module first, and context second.