side effects and meta props for field #709
-
1. add side effects prop to fieldIt's a very common pattern to trigger side effects when field event triggers. For workaround, I tried to add side effect to <form.Field
name="foo"
effects={{
onChange: ({ fieldApi }) => fieldApi.form.setFieldValue('someOtherField', undefined),
// same fields with validators
}}
> 2. add meta prop to fieldAnother common pattern is when you want to inject additional meta context to field from form status. <form.Field
name="foo"
meta={({ fieldApi }) => ({
disabled: fieldApi.form.getFieldValue('someOtherField') == null,
...
})}
// or maybe expose values directly like form.Subscribe
meta={({ values }) => ({
disabled: values.someOtherField == null,
...
})}
>
{(field, meta) => <Comp
disabled={meta.disabled}
... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
These are actually really impressive API ideas. Can you make GH issues for each of them and we can discuss each with their own merits? |
Beta Was this translation helpful? Give feedback.
These are actually really impressive API ideas. Can you make GH issues for each of them and we can discuss each with their own merits?