Skip to content

Can a primitive atom hold a function? #1238

Closed Answered by dai-shi
AjaxSolutions asked this question in Q&A
Discussion options

You must be logged in to vote

You need to wrap with an object.

const fnAtom = atom({ fun: () => 'hello' })

This works: atom(() => fn)

It doesn't create a primitive atom. It creates a read-only atom.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AjaxSolutions
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