Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 4
    what is the initial value of fields in state? Commented Oct 30, 2017 at 9:48
  • 2
    constructor(props) { super(props); this.state = { fields: {}, errors: {} } this.onSubmit = this.onSubmit.bind(this); } Commented Oct 30, 2017 at 9:50
  • 2
    Possible duplicate of React - changing an uncontrolled input Commented May 7, 2019 at 3:05
  • I just discovered you can use useRef to conditionally set the value to the current input, e.g. value={amountInputFocused ? amountRef.current?.value : amountState}. Not sure if this is by design, but it works, and silences the error. Commented Dec 11, 2021 at 7:27