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.

Not wipe out DOM when changing values?

See original GitHub issue

Firstly, great idea! Love it.

However, when changing values, React completely wipes out the DOM inside the radio components. This is not ideal when wanting to animate the radio buttons after being checked etc.

The best I could come up with (while still keeping the same pattern) was to use defaultChecked on the inputs instead of checked, and make shouldComponentUpdate inside the parent return false. Effectively making it an “uncontrolled” component.

Feel free to close this issue as it’s kinda solved — I was just wondering if you had any thoughts how this could be done a little cleaner?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:25 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nkbtcommented, Mar 17, 2016

Both solutions i submitted are not really perfect. I am not sure. Would prefer to find better one On Fri, 18 Mar 2016 at 7:31 AM, bsr203 notifications@github.com wrote:

hi @nkbt https://github.com/nkbt any plan for merging or using function component? thanks.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/chenglou/react-radio-group/issues/12#issuecomment-198069482

0reactions
chengloucommented, Jun 28, 2016

Alright, so the PR is merged. Please try master (67a2bcdc7f3d0c8cb4d7762f82558d75c9592ea9). Things should work now. @danielberndt and @nkbt can publish this =).

Sorry for the wait!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to save input values to the DOM and not have them reset ...
Here I have a Ecommerce Website (using for practice). The data I am inputting onto the screen is from JSON. But the issue...
Read more >
How To Make Changes to the DOM - DigitalOcean
In this tutorial, we will go over how to create new nodes and insert them into the DOM, replace existing nodes, and remove...
Read more >
How to Create, Insert and Delete DOM Elements with JavaScript
Start your free seven days of learning with the Techdegree: https://trhou.se/3cIENVgGuil's project files: ...
Read more >
DOM diffing with vanilla JS: part 2 - Go Make Things
If the element isn't new and doesn't need to be replaced, we need to check if any attributes have changed and need to...
Read more >
Manipulating documents - Learn web development | MDN
Moving and removing elements​​ There may be times when you want to move nodes, or delete them from the DOM altogether. This is...
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