omerman / jotai-nexus

MIT License
11 stars 2 forks source link

Jotai v2 #2

Open A-Shleifman opened 1 year ago

A-Shleifman commented 1 year ago

It might be worth stating in the readme that Jotai v2 has a native solution for this problem.

import { getDefaultStore } from 'jotai';

const store = getDefaultStore();
export const readAtom = store.get;
export const writeAtom = store.set;

And it doesn't require a react component to be rendered before read and white functions are available.

omerman commented 1 year ago

Saw it only now 😅 I will update the readme accordingly and maybe archive it. Thank you 🙏