-
I am working on an application that will dynamically render large forms from an object. This includes conditional sections of the form. What is the best way to structure a Zustand store so that;
My assumption is that the Zustand store should be created on the module level of the Form component, with an array of objects that store user input and optional validation error message from each form field. Maybe this is made available by passing the Zustand store as a prop, or as a Provider? Problem is that when I gave this a go on my dev application, setting the error message underneath the relevant input re-rendered the entire form. This will be a problem with 30+ inputs. It this because I'm setting Zustand state from within the Form component, but I should be doing it from within the Input component? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you would like to use Zustand store with Context, |
Beta Was this translation helpful? Give feedback.
If you would like to use Zustand store with Context,
zustand/context
may help.