diff --git a/docs/framework/react/guides/basic-concepts.md b/docs/framework/react/guides/basic-concepts.md index 0f0e1155..bf4d72dc 100644 --- a/docs/framework/react/guides/basic-concepts.md +++ b/docs/framework/react/guides/basic-concepts.md @@ -212,6 +212,8 @@ Example: /> ``` +More information can be found at [Listeners](./listeners.md) + ## Array Fields Array fields allow you to manage a list of values within a form, such as a list of hobbies. You can create an array field using the `form.Field` component with the `mode="array"` prop. diff --git a/docs/framework/react/guides/listeners.md b/docs/framework/react/guides/listeners.md index cf10542f..a1fa5796 100644 --- a/docs/framework/react/guides/listeners.md +++ b/docs/framework/react/guides/listeners.md @@ -8,12 +8,12 @@ For situations where you want to "affect" or "react" to triggers, there's the li Imagine the following user flow: - User selects a country from a drop-down. -- User then selects a county from another drop-down. +- User then selects a province from another drop-down. - User changes the selected country to a different one. -In this example, when the user changes the country, the selected county needs to be reset as it's no longer valid. With the listener API, we can subscribe to the onChange event and dispatch a reset to the field "county" when the listener is fired. +In this example, when the user changes the country, the selected province needs to be reset as it's no longer valid. With the listener API, we can subscribe to the onChange event and dispatch a reset to the field "province" when the listener is fired. -Other events that can be "listened" to are: +Events that can be "listened" to are: - onChange - onBlur @@ -25,7 +25,7 @@ function App() { const form = useForm({ defaultValues: { country: '', - county: '', + province: '', }, // ... }) @@ -41,7 +41,7 @@ function App() { onChange={(e) => field.handleChange(e.target.value)} listener={{ onChange: ({ value }) => { - form.reset({county: ''}) + form.reset({province: ''}) } }} /> @@ -49,10 +49,10 @@ function App() { )} -