Improvement:
- Fix initial value undefined issue when passed as prop for useField - Input - Select - Collection - TextArea
Example:
const CustomField = ({ name }) => {
const { value } = useField({ type: "text", name, value: "5" });
// Now, value it is defined since the first render => value = "5"
// does not need to wait for the <Form /> to be READY
return (
<pre>
<code data-testid="output">{JSON.stringify(value)}</code>
</pre>
);
};
function App() {
return (
<Form>
<Input type="text" name="user" value="BeBo" />
<CustomField name="other" />
</Form>
);
}