Splitting a large object #1303
-
Let's say I have an atom containing initialData as in this example. How could I create from this atom a read-only atom which contains only names? [{ name: 'Luke Skywalker’}, { name: 'C-3PO' }] |
Beta Was this translation helpful? Give feedback.
Answered by
dai-shi
Jul 24, 2022
Replies: 1 comment
-
This? const dataAtom = atom(initialData)
const nameAtom = atom((get) => get(dataAtom).people.map(({ name }) => ({ name }))) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
AjaxSolutions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This?