Open jschr opened 7 years ago
Currently createForm is only called on componentWillMount. If props change and the form's initial state depends on props it won't be updated.
createForm
componentWillMount
Add a value prop to <FormProvider> to allow for updating the form state if props have changed. Also paves the way for improved composability.
value
<FormProvider>
<FormProvider form={form} value={props.user} onSubmit={saveUser}> ... </FormProvider>
This may make withForm accepting a function of props redundant.
withForm
Currently
createForm
is only called oncomponentWillMount
. If props change and the form's initial state depends on props it won't be updated.Add a
value
prop to<FormProvider>
to allow for updating the form state if props have changed. Also paves the way for improved composability.