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

228
Views
"A component is changing an uncontrolled input to be controlled." this error showing in React JS

When I write this code:

import React, { useState } from "react";

export default function App() {
  const [email, setEmail] = useState("student@example.com");

  return (
    <div>
      <input
        type="text"
        name="name"
        value={email}
      />
    </div>
  );
}

And run on the browser. This gives me this Warning:

Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.

How can I solve this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can't change the input value because the email state doesn't change. if you want to change the input value you have to use the onChange event in the input tag and then onChange update the state.

about 4 years ago · Juan Pablo Isaza Report
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!