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

91
Views
React Input does not change nor does it get added

I've got this state and change function

const [mitarbeiter, setMitarbeiter] = useState({
    lastName: "",
    firstName: "",
    quartal: "",
    snummer: "",
    email: "",
    eintrittsdatum: "",
    austrittsdatum: "",
    isAushilfe: false,
});

const handleChange = (event) => {
    const value = event.target.value;
    
    setMitarbeiter({
        ...mitarbeiter,
        [event.target.name]: value
    });
    console.log(event.target.name)
    console.log(mitarbeiter)
};

This is my input field where i try to insert something and want it to update the lastName value of my state

<input id="name" type="text" placeholder="Name.." defaultValue="" value={mitarbeiter.lastName} onChange={handleChange}/>

Does someone know where my error is? It just creates a new value and does not change the previous one and i cant input any text into the input field

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!