How can I update my element after return a function? For example:
myFunction(condition){
if(condition){
return(
<Text>True</Text>
)
}
return(
<Text>False</Text>
)
}
render(){
return(){
<View>
{this.myFunction(condition)}
</View>
}
}
I have the same case, but the element is updated once Even calling it other times the component is not updated.
Obs.: The condition is changing by other functions.
Thanks!!
How about make component like
changeCondition(condition){
this.setState({condition})
}
render(){
return(
<View>
<Text>{this.state.condition ? "True" : "False"}</Text>
</View>
)
}
This is more complying with react rules
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.