Skip to content

Unable to use as a controlled component #109

Open
@armujahid

Description

@armujahid

I am unable to use it as a controlled component using useState hook.
Demo: https://codesandbox.io/s/nnqlnxozxj
Code:

function App() {
  const [val, setVal] = useState(15);
  const handleChange = value => {
    setVal(20);
    console.log(val);
  };
  return (
    <div className="App">
      <NumericInput value={val} onChange={handleChange} />
    </div>
  );
}

Desired behavior: Its value should update from 15 to 20 and then should lock at 20
Current behavior: Value is updating from 15 to 20 just on first change. Its not locking to 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions