I have a default state in my constructor
this.state {
showModal:false
}
then how can I toggle the value without declaring a function, but straight away do that in JSX? I found it's too much of code to do it in a function. Can't it be more simple just do it like
render(){
return(<div onClick={()=>this.setState({showModal:!showModal})}></div>)
}
But I got error of syntax error in my JSX above. Why?