DEV Community

Avnish Jayaswal
Avnish Jayaswal

Posted on • Edited on • Originally published at askavy.com

React Form

How to use React Form with form validation(Code Example)

import React, { useState } from "react"; import "bootstrap/dist/css/bootstrap.min.css"; import "./App.css"; function App() { return ( <div classNameNameName="App"> <div className="container"> <div className="row d-flex justify-content-center"> <div className="col-md-4"> <form> <div className="form-group"> <label for="exampleInputEmail1">Email address</label>  <input type="email" className="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email" /> <small id="emailHelp" className="form-text text-muted"> We'll never share your email with anyone else. </small> </div> <div className="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" className="form-control" id="exampleInputPassword1" placeholder="Password" /> </div> <div className="form-group form-check"> <input type="checkbox" className="form-check-input" id="exampleCheck1" /> <label className="form-check-label" for="exampleCheck1"> Check me out </label> </div> <button type="submit" className="btn btn-primary"> Submit </button> </form> </div> </div> </div> </div> ); } export default App; 
Enter fullscreen mode Exit fullscreen mode

Main document: https://react-hook-form.com/

Source : React Form

Top comments (0)