Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Jotai v2 #2

Open
A-Shleifman opened this issue Feb 16, 2023 · 1 comment
Open

Jotai v2 #2

A-Shleifman opened this issue Feb 16, 2023 · 1 comment

Comments

@A-Shleifman
Copy link

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
Copy link
Owner

omerman commented Jul 7, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants