Skip to content

v1.0.2

Latest
Compare
Choose a tag to compare
@dmaskasky dmaskasky released this 24 Aug 23:04
· 4 commits to main since this release
458b14e
  • Addresses a compatibility issue with jotai@2.9.0 that caused atomEffects to lose their dependencies during recomputations.
  • Introduces a new utility helper withAtomEffect

Usage

const anAtom = atom(0)

// the effect is automatically added to the resulting atom
// setting the resulting atom is forwarded to the atom passed in
const anAtomWithEffect = withAtomEffect(anAtom, (get, set) => {
  console.log(`anAtom value is now ${get(anAtom)}`)
})
...
const [value, setValue] = useAtom(anAtomWithEffect)