-
Notifications
You must be signed in to change notification settings - Fork 393
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
<input type="radio"> checked state not saved #84
Labels
Comments
Solution would be the same as #79. Walk through all radios and write out checked dom property as html attribute. Array.from(document.querySelectorAll('[type=radio]'))
.forEach(x => {
if (x.checked) {
x.setAttribute('checked', 'checked')
}
}); I wonder what else should be fixed that way |
fixed in 1.7.0 |
Fantastic, thank you very much! |
This was referenced Jan 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The state of radio input elements is not saved ot the generated html. React doesn't update it on hydrate() so for pages where there's a default checked radio button the form stays empty until the user clicks something. If there are multiple sets of radio buttons, when the user clicks one, react will also update the state of the other ones, so clicking any radio button suddenly displays the default values of the other radio buttons as well.
I'm using reactstrap, its input elements are using the checked property, which doesn't get written to the dom as attributes, but for the prerendered page it needs to be written out.
The text was updated successfully, but these errors were encountered: