Untitled
unknown
javascript
2 years ago
581 B
5
Indexable
import React, { useRef } from "react"; import { useForm } from "react-hook-form"; export default function App() { const { register, handleSubmit } = useForm(); const contohCustomRef = useRef(null); const registerInputA = register("nama_input_a"); return ( <form onSubmit={handleSubmit(onSubmit)}> <input name="dobYear" type="text" {...registerInputA} ref={(e) => { registerInputA.ref(e); contohCustomRef.current = e; }} /> <button>Submit</button> </form> ); }
Editor is loading...