Closed iusehooks closed 3 years ago
const CustomField = ({ name }) => { const { value, setValue } = useField({ type: "custom", name, value: "5" }); const onSetValue = () => setValue(prev => ++prev) return ( <pre> <code data-testid="output">{JSON.stringify(value)}</code> <button type="button" onClick={onSetValue}>Set Value</button> </pre> ); }; function App() { const formRef = useRef(); const inputRef = useRef(); return ( <Form innerRef={formRef} > <Input innerRef={inputRef} type="text" name="user" value="BeBo" /> </Form> ); }
Improvement:
Example: