I'm trying to show button inside div block using react. But it is showing error Parsing error: Unexpected keyword 'this'.
<div >
{
{this.state.selectedTag} ? <button onClick={() => { this.resetTagState() }}>
Reset </button> :
}
</div>
There is no need to put another bracket before the keyword "this". Also, you can siplify the onClick callback, and the "else" condition is missing after the semi colon. I think the following will work for you:
<div>
{
this.state.selectedTag
? <button onClick={this.resetTagState}>
Reset
</button>
: null
}
</div>