npm jotai-effect 1.1.4
v1.1.4

latest releases: 2.2.1, 2.2.0, 2.1.7...
10 months ago

🚀 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__ to tests and 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.4

We hope you enjoy these updates! Feedback and contributions are always welcome. Open an issue if you encounter any problems.

Don't miss a new jotai-effect release

NewReleases is sending notifications on new releases.