Replies: 2 comments 1 reply
-
Assuming I'm correct above, maybe a way to track all the fields is to use a prefix key?
Okay, so something like that? Is that inefficient? I want to be able to have my field default values come from Something I don't understand is how recoil decides what to update. I am thinking out loud, I appreciate all thoughts here! I'm excited about recoil :) |
Beta Was this translation helpful? Give feedback.
-
Snapshots can be inefficient, as they deal with all state, and atom family key mangling is always subject to change. Trying to understand better what you are trying to accomplish. If you're trying to scope some atoms by part of the component tree, then common patterns include piping props or using React Context to provide parameters to |
Beta Was this translation helpful? Give feedback.
-
TLDR:
I really like this pattern:
The
ControlledField
is a wrapper that setsvalue
,onChange
anderror
from a context, in my last project, we usedreact-hook-form
with a custom context, where all the defaults get loaded in.It seems like recoil hooks don't know where they are in the component tree, so I'd need to pass some shared key by piping it or use ReactContext.
I'm looking at
react-recoil-form
for inspiration, but my current sense is that it's nice if possible to roll your own fetching / form management, because then it can all be integrated nicely, of course this is harder, but if done well, can be simple and expressive.Beta Was this translation helpful? Give feedback.
All reactions