Not wipe out DOM when changing values?
See original GitHub issueFirstly, 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:
- Created 8 years ago
- Comments:25 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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:
Alright, so the PR is merged. Please try master (67a2bcdc7f3d0c8cb4d7762f82558d75c9592ea9). Things should work now. @danielberndt and @nkbt can publish this =).
Sorry for the wait!