I want to access the boolean value of child's property "checked" in ReactJS. Now I have the following render method.
Class LoginCard.js
render() {
return (
<Card style={styles.card}>
<UserIcon/>
<UPSection ref="inputs" updateUName={this.updateInputState_Username} updatePWord={this.updateInputState_Password}/>
<RememberMe ref="RemMeChk"/> //This conponent containing the checkbox.
<LoginBtn onClick={this.handleLoginBtnClicked}/>
</Card>
);
}
I want to get the bool checked
value in component RememberMe
. The following shows you the render method of RememberMe
.
Class RememberMe.js
render() {
return (
<div style={styles.div}>
<Checkbox ref="rm" label="Remember Me" labelStyle={styles.text} />
</div>
);
}
The component Checkbox
is from Material UI and it has the property of checked
. I try to use var isRemMeChked = ReactDOM.findDOMNode(this.refs.RemMeChk.refs.rm).checked;
inside the class LoginCard to access the bool value but it is undefined. What is the proper way to access the bool value?