Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Problem is i am using form with hooks and n event handler onChange and onSubmit but while executing my form isnt taking any value
import React ,{useState} from 'react';

const Lifecycle = () =>{
    const [data,setData] = useState({
        uname : "",
        phone : "",
    });
    
    const handler = e=>{
        setData({...data,[e.target.name]:e.target.value});
    };
    const submitHandler = e=>{
        e.preventDefault();
        console.log(data)
    }
    const{uname,phone}=data;
    return(<>
          <div className="container w-50 ">
            
         <form onSubmit={submitHandler}>
         <label className="form-label">Name</label>
           <input type ="text" className="form-control " Value={uname} onChange={ handler} />

           <label className="form-label">Phone</label>
           <input type ="number" className="form-control" Value={phone} onChange={handler}/>

           <button type="submit" className="btn btn-primary my-2">submit</button>
         </form>
            
        
          </div>
</>)

    }
export default Lifecycle;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!