-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Forms Update #8112
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
Forms Update #8112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few style nitpicks but I think this is good to go once those are dealt with.
@@ -91,9 +93,9 @@ An **uncontrolled** component manages its own state. | |||
} | |||
``` | |||
|
|||
If you wanted to listen to updates to the value, you could use the `onChange` event just like you can with controlled components. | |||
If you wanted to listen to updates to the value, you could use the `onChange` event just like you can with controlled components, however you would _not_ pass the value you saved to the component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a phrasing nitpick - can you break this up into two sentences like:
If you wanted to listen to updates to the value, you could use the
onChange
event just like you can with controlled components. However, you would not pass the value you saved to the component.
} | ||
let value = event.target.value; | ||
let checked = this.state.checked; // copy | ||
if(!checked[value]) { checked[value] = true; } else { checked[value] = false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put a space after if
and break this up into multiple lines so it matches the style of other parts?
this.setState({checked: checked}) | ||
} | ||
|
||
handleSubmit(event) { | ||
alert("Boxes checked are: '" + this.state.checked + "'"); | ||
alert("Boxes checked: " + | ||
(this.state.checked.A?"A ":"") + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put spaces around the ?
and :
operators when you're ternarying
this.setState({checked: checked}) | ||
} | ||
|
||
handleSubmit(event) { | ||
alert("Boxes checked are: '" + this.state.checked + "'"); | ||
alert("Boxes checked: " + | ||
(this.state.checked.A ? "A ":"") + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around the :
too, plz
Thank you! |
* Reapplied fixes to updated docs from master * Reapplied fixes to Forms, removed ES2016 function includes() * Missing carriage return * Adding back some line breaks * Making requested changes. * Making space changes
* Reapplied fixes to updated docs from master * Reapplied fixes to Forms, removed ES2016 function includes() * Missing carriage return * Adding back some line breaks * Making requested changes. * Making space changes
Fixes 8052
Fixes 8068