Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use as a controlled component #109

Open
armujahid opened this issue Feb 10, 2019 · 0 comments
Open

Unable to use as a controlled component #109

armujahid opened this issue Feb 10, 2019 · 0 comments

Comments

@armujahid
Copy link

armujahid commented Feb 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant