I'm getting an error message 'Expecting '}'' just before calling the Function Expression in code given below.
class IfElse extends React.Component{
render(){
return(
<div>
{
(booleanExp)=>{
return(
<a href={(booleanExp)?'login':'logout'}>{(booleanExp)?'login':'logout'}</a>
)
}(this.props.booleanExp)
}
</div>
)
}
};
The error is here: }(this.props.booleanExp)
, just after the curly brace. If i remove the function invocation, then there is no error But function call is required for me.