mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-27 03:08:06 +00:00
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
8a54f20ee1
commit
47215f9d06
@@ -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