-
Notifications
You must be signed in to change notification settings - Fork 51
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
class extends React.Component vs React.createClass() #17
Comments
|
I hope we can close this. |
Apologies for re-opening this old thread. In short, I'm trying to implement a
So, I have to ask, @arunoda:
I'm a beginner and I'm sincerely eager to learn. Regards, Nadeeem |
here is a simple example of class Checkbox extends React.Component {
constructor(props) {
super(props);
this.state = {
checked: props.defaultValue,
};
this.handleValuesChange = this.handleValuesChange.bind(this);
}
handleValuesChange() {
const state = {
checked: !this.state.checked,
};
this.setState(state);
this.props.onChange(state);
}
render() {
return <div>
<label>
<input type="checkbox" onChange={this.handleValuesChange} checked={this.state.checked}/> email
</label>
</div>;
}
} |
why are you preferring
class extends React.Component
?is it only preferred in demo app, or it's a Mantra standard?
The text was updated successfully, but these errors were encountered: