👻 Primitive and flexible state management for React
This version introduces a new feature atomWithLazy
and deprecates useReducerAtom
and freezeAtomCreator
. It also introduces an experimental store implementation in jotai/experimental
.
selectAtom
selectAtom
will no longer internally unwrap promises. To migrate to the new api, use the unwrap
utility from jotai/utils
package.
// suppose we have this
const baseAtom = atom(Promise.resolve({ id: 0, name: 'test' }))
// previously selectAtom would internally unwrap promises.
const idAtom = selectAtom(
baseAtom,
({ name }) => name,
(prev, curr) => prev.id === curr.id
)
// instead, you need to import `unwrap` from 'jotai/utils' and pass the unwrapped atom
import { unwrap } from 'jotai/utils'
...
const idAtom = selectAtom(
unwrap(baseAtom),
({ name }) => name,
(prev, curr) => prev.id === curr.id
)
useReducerAtom
https://jotai.org/docs/recipes/use-reducer-atom
freezeAtomCreator
https://jotai.org/docs/guides/debugging#freezeatomcreator
store2.ts
by @dai-shi in https://github.com/pmndrs/jotai/pull/2463
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.7.2...v2.8.0
Mostly refactors.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.7.1...v2.7.2
This fixes a regression in v2.7.0.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.7.0...v2.7.1
We've improved the use of WeakMap for better memory management. Please report to us if any regressions are found.
pendingMap
a WeakMap for better memory management by @dai-shi in https://github.com/pmndrs/jotai/pull/2396
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.5...v2.7.0
Some type improvements!
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.4...v2.6.5
Performance improvement! Check it out!
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.3...v2.6.4
Some improvements in core and utils 👏
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.2...v2.6.3
Some improvements for atomWithStorage. Feedback is welcome.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.1...v2.6.2
This version has two minor improvements for library authors. It's wonderful to see Jotai ecosystem growing. No major bugs have been reported lately. It's fairly okay to say the current version is pretty stable.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.6.0...v2.6.1
We can now directly use <Provider>
in React Server Components. 🎉
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.5.1...v2.6.0