question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkbox doesn't update checked value on setState

See original GitHub issue

Here’s the failing example, taken directly from the docs.

Removing e.preventDefault(); fixes the example.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
z-vrcommented, Nov 14, 2017
0reactions
z-vrcommented, Nov 14, 2017

@developit but what if after the click on the checkbox I want the checked attributed to stay in accordance with the checked property, e.g., <input checked={false}>. Is it even possible?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Checkbox Does Not Update - Stack Overflow
Save this question. Show activity on this post. I want to update an array each time a checkbox is toggled to true. With...
Read more >
input checkbox not updating after re-render #13477 - GitHub
However, in my app, the checkbox is not checked. If I explicit set the defaultChecked property to true, then it will be checked....
Read more >
How to Fix the Issue Where You Can't Change Checkbox ...
To fix the issue where you can't change checkbox state in React, we should set the checked prop of the checkbox to a...
Read more >
[Solved]-React Checkbox Does Not Update-Reactjs
setState () enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the...
Read more >
How To Use React Checkbox onChange Feature (with Code ...
In React, the best way to do this is via the useState hook. This is different from normal JavaScript because we are unable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found