Skip to content
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

Checkbox not changing the state. #35

Closed
flexdhana opened this issue Aug 12, 2016 · 2 comments
Closed

Checkbox not changing the state. #35

flexdhana opened this issue Aug 12, 2016 · 2 comments

Comments

@flexdhana
Copy link

flexdhana commented Aug 12, 2016

I have successfully included with my project, but checkbox not changing the state dynamically on click. But its changing when i change the component properties "checked={true} (or) checked={false}"

any suggestion?

@bogdancarmanus
Copy link
Contributor

This is the way it works. The state of the checkbox must be changed outside the component using onChange event.

@flexdhana
Copy link
Author

flexdhana commented Aug 12, 2016

@bogdancarmanus , thanks, i made it work by following change..

constructor(props){
super(props);
this.state = {
checked: false
};
}

checkBoxChanged()
{
this.state.checked?this.setState({checked: false}):this.setState({checked: true});
}

             <CheckBox label='Label'
                checked={this.state.checked}
                 onChange={this.checkBoxChanged.bind(this)}
                 />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants