Fix controlled/uncontrolled validation for radio+checkbox inputs - #7003
Merged
Conversation
Contributor
Author
|
cc @spicyj |
jimfb
force-pushed
the
uncontrolled-checkbox
branch
from
June 9, 2016 01:54
31c0b79 to
38f06f2
Compare
| function isControlled(props) { | ||
| return ((props.type === 'checkbox' || props.type === 'radio') && props.checked !== undefined) || | ||
| (props.type !== 'checkbox' && props.type !== 'radio' && props.value !== undefined); | ||
| } |
Contributor
There was a problem hiding this comment.
This spacing isn't FB style and this would be clearer anyway; can you change it?
function isControlled(props) {
var usesChecked = props.type === 'checkbox' || props.type === 'radio';
return usesChecked ? props.checked !== undefined : props.value !== undefined;
}
jimfb
force-pushed
the
uncontrolled-checkbox
branch
from
June 9, 2016 02:45
38f06f2 to
2152f5b
Compare
|
@jimfb updated the pull request. |
| checked={false} | ||
| onChange={() => null} | ||
| />, container); | ||
| console.log(console.error.calls.argsFor(0)[0]); |
Contributor
There was a problem hiding this comment.
Did you mean to leave this console.log call here? 😃
Contributor
Author
There was a problem hiding this comment.
We need a lint rule for that.
Contributor
|
semver labels on this and #7006 please? |
zpao
pushed a commit
that referenced
this pull request
Jun 14, 2016
(cherry picked from commit 0bb0fe8)
1 task
mrizwanashiq
pushed a commit
to mrizwanashiq/react
that referenced
this pull request
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix controlled/uncontrolled validation for radio+checkbox inputs
Fixes #6779