Skip to content

Storing a basic object #1174

Closed Answered by dai-shi
TwistedMinda asked this question in Q&A
May 19, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Have you seen https://jotai.org/docs/advanced-recipes/large-objects?

selectAtom is actually only meaningful if you need equalityFn, and it's an escape hatch.

const derivedAtom = selectAtom(baseAtom, x => x * 2);
// can be written as
const derivedAtom = atom((get) => get(baseAtom) * 2);

focusAtom can create a writable atom. selectAtom can create only a read-only atom.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TwistedMinda
Comment options

TwistedMinda May 20, 2022
Collaborator Author

Answer selected by TwistedMinda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants