🚀 Highlights
1. New observe API for Managing Side-Effects
PR: #55
This release introduces the observe API, a lightweight and flexible utility for managing global side effects in Jotai. observe allows you to subscribe to state changes on a Jotai store and execute reactive logic without being tied to React's lifecycle.
Example Usage
import { observe } from 'jotai-effect'
observe((get, set) => {
set(logAtom, `someAtom changed: ${get(someAtom)}`)
})Usage With React
When using a Jotai Provider, pass the store to both observe and the Provider to ensure the effect is mounted on the correct store.
const store = createStore()
observe((get, set) => {
set(logAtom, `someAtom changed: ${get(someAtom)}`)
}, store)
<Provider store={store}>...</Provider>observe makes managing Jotai state-dependent logic simpler and more ergonomic. Check out the documentation for more details.
2. Repository Modernization
PR: #57
This release also modernizes the repository to align with the latest development standards:
- Switched to Vite + Vitest for faster builds and modern testing.
- Updated TypeScript and ESLint Configurations to leverage modern tooling.
- Improved Repository Structure by renaming
__tests__totestsand removing outdated examples. - Enhanced README Clarity to simplify onboarding and usage.
📦 Installation
To update to v1.1.4, run:
npm install jotai-effect@1.1.4We hope you enjoy these updates! Feedback and contributions are always welcome. Open an issue if you encounter any problems.