I am getting an error in my code of handleSubmit function because ,here I am using this syntax 'export const Register = ()',so what needs to be fixed in my code so that I;m able to use the handleSubmit function I'll paste the code down below it keeps saying its not defined ive tried adding function handleSubmit() and const handleSubmit = () but its still not working any help on how to resolve this error please
export const Register = () => { handleSubmit = e => { e.preventDefault(); console.log('works!'); }; return ( <form onSubmit={this.handleSubmit}> <h3>Sign Up</h3> <div className="form-group"> <label> First Name</label> <input type="text" className="form-control" placeholder="First Name" /> </div> <div className="form-group"> <label> Last Name</label> <input type="text" className="form-control" placeholder="Last Name" /> </div> <div className="form-group"> <label> Email</label> <input type="email" className="form-control" placeholder="Email" /> </div> <div className="form-group"> <label> Password</label> <input type="password" className="form-control" placeholder="Password" /> </div>` <div className="form-group"> <label> Confirm Password</label> <input type="password" className="form-control" placeholder="Confirm Password" /> </div>` <button className="btn btn-primary btn-block">Sign Up</button> </form> ); } export default Register;
Quote:I am getting an error in my code of handleSubmit function because ,here I am using this syntax 'export const Register = ()',so what needs to be fixed in my code so that I;m able to use the handleSubmit function I'll paste the code down below it keeps saying its not defined ive tried adding function handleSubmit() and const handleSubmit = () but its still not working any help on how to resolve this error please
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)