Can I import selectors` { get, set } functions directly? #1150
Unanswered
schmidlidev
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I don't think so, because the For what it's worth, your solution seems fine to me. Maybe it would make more sense if |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Selectors expose
get
andset
by passing them as parameters to your selectors` functions. Are these functions exposed by the Recoil package in any other way?I have somewhat complex interdependent state. I have some writeable selectors that read from and write to many other atoms. I would like to extract out some of this logic for re-use. For example, from within several of my selector's
set:
functions, I want to call the samedoAction()
function.Trivially, I can have my re-useable function accept {get, set} in its parameters, and just forward the references from within the selector:
But it would just be cleaner if my extracted function could simply import
get
andset
from Recoil, so that they don't need to be passed in as parameters. Is this possible?Beta Was this translation helpful? Give feedback.
All reactions