Update forms.md (#8136)
The component Form in "Uncontrolled Radio Button" example doesn't need state, because it does not used in render() method.
This commit is contained in:
committed by
Kevin Lacker
parent
34fd4f4aa0
commit
abeae306e5
@@ -397,17 +397,17 @@ ReactDOM.render(
|
||||
class Form extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {value: 'B'};
|
||||
this.value = 'B';
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
handleChange(event) {
|
||||
this.setState({value: event.target.value});
|
||||
this.value = event.target.value;
|
||||
}
|
||||
|
||||
handleSubmit(event) {
|
||||
alert('Radio button value is: ' + this.state.value);
|
||||
alert('Radio button value is: ' + this.value);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user