()
| 3 | import { useForm } from 'react-hook-form'; |
| 4 | |
| 5 | export default function App() { |
| 6 | const { register, handleSubmit } = useForm(); |
| 7 | const onSubmit = (data) => { |
| 8 | alert(JSON.stringify(data)); |
| 9 | }; |
| 10 | |
| 11 | return ( |
| 12 | <div className="App"> |
| 13 | <form onSubmit={handleSubmit(onSubmit)}> |
| 14 | <div> |
| 15 | <label htmlFor="firstName">First Name</label> |
| 16 | <input name="firstName" placeholder="bill" ref={register} /> |
| 17 | </div> |
| 18 | |
| 19 | <div> |
| 20 | <label htmlFor="lastName">Last Name</label> |
| 21 | <input name="lastName" placeholder="luo" ref={register} /> |
| 22 | </div> |
| 23 | |
| 24 | <div> |
| 25 | <label htmlFor="email">Email</label> |
| 26 | <input |
| 27 | name="email" |
| 28 | placeholder="bluebill1049@hotmail.com" |
| 29 | type="email" |
| 30 | ref={register} |
| 31 | /> |
| 32 | </div> |
| 33 | <button type="submit">Submit</button> |
| 34 | </form> |
| 35 | </div> |
| 36 | ); |
| 37 | } |
nothing calls this directly
no test coverage detected