Javascript react native-如何在构造函数中使用状态
我想在其他状态的定义中使用一个状态,但我没有得到任何值。Javascript react native-如何在构造函数中使用状态,javascript,android,ios,react-native,Javascript,Android,Ios,React Native,我想在其他状态的定义中使用一个状态,但我没有得到任何值。 有人有什么想法吗 constructor(props) { super(props); this.state = { check : false, datatotal : this.props.services.map((d) => <CheckBox center title={d}
有人有什么想法吗
constructor(props) {
super(props);
this.state = {
check : false,
datatotal : this.props.services.map((d) =>
<CheckBox
center
title={d}
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked= {true}
onPress={() => this.checkBoxClick()}
/>
)
};
}
构造函数(道具){
超级(道具);
此.state={
检查:错误,
datatotal:this.props.services.map((d)=>
this.checkBoxClick()}
/>
)
};
}
嘿,签出此链接可能会对您有所帮助:您可以在组件中使用此链接
constructor(props){
super(props);
this.state = {
check: false
}
}
render() {
<View>
{this.props.services && this.props.services.map(
<CheckBox
center
title={d}
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked= {true}
onPress={() => this.checkBoxClick()}
/>
)</View>}
}
构造函数(道具){
超级(道具);
此.state={
检查:错误
}
}
render(){
{this.props.services&&this.props.services.map(
this.checkBoxClick()}
/>
)}
}
在其他状态的定义中使用一个状态,但我没有得到任何值
,这意味着什么?你能详细解释一下吗?