👻 Primitive and flexible state management for React
This includes some improvements in jotai/utils
. Especially, unstable_unwrap
is getting to be stable.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.2.0...v2.2.1
It includes a few improvements. Some utils are rewritten as there was a misconception when migrating from v1. ESM builds are optimized for Vite users.
jotai/utils
atomWithDefault
// suppose we have this
const asyncAtom = atom(() => Promise.resolve(1))
const countAtom = atomWithDefault((get) => get(asyncAtom))
// and in component
const setCount = useSetAtom(countAtom)
// previously,
setCount((c) => c + 1) // it worked, but it will no longer work
// instead, you need to do this
setCount((countPromise) => countPromise.then((c) => c + 1))
atomWithStorage
// suppose we have async storage
const storage = createJSONStorage(() => AsyncStorage)
const countAtom = atomWithStorage('count-key', 0, storage)
// in component
const [count, setCount] = useAtom(countAom)
// previously, countAtom is a sync atom, so you could update like this:
setCount((c) => c + 1)
// with the new version, it becomes async occasionally, so you need to resolve it:
setCount(async (c) => (await c) + 1)
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.1.1...v2.2.0
This version fixes some issues in edge cases.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.1.0...v2.1.1
This includes some improvements as well as some breaking changes in unstable features.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.0.4...v2.1.0
This includes some small improvements. One of them is to improve Deno compatibility.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.0.3...v2.0.4
This release includes important features for upcoming devtools.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.0.2...v2.0.3
This version add some small improvements, mostly for some minor cases.
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.0.1...v2.0.2
This adds various small improvements. Docs are also updated.
__DEV__
with ts-jest by @dai-shi in https://github.com/pmndrs/jotai/pull/1742
Full Changelog: https://github.com/pmndrs/jotai/compare/v2.0.0...v2.0.1
Async atom behavior is revisited and changed. TypeScript types are changed and improved.
Exposes createStore
which opens up new usages. With its power, it can be misused. Let's look for best practice. Feedback is appreciated.
https://github.com/pmndrs/jotai/blob/v2.0.0/docs/guides/migrating-to-v2-api.mdx
Full Changelog: https://github.com/pmndrs/jotai/compare/v1.13.1...v2.0.0
Following v1.13.0, this version drops jotai/react/devtools
entry point which was for pre-released v2 API. The same feature will be provided from jotai-devtools
package.
Full Changelog: https://github.com/pmndrs/jotai/compare/v1.13.0...v1.13.1