I have a class App that extends React.Component, in App there is the following render() code
render() {return(
<div style={styles}>
<button type="submit" value="Go" onClick=" alert('Hi') ">Go</button>
</div>
)}
replacing the quotations with curly brackets make the code work
<button type="submit" value="Go" onClick={ alert('Hi') }>Go</button>
I know that in React we should use { }
if we want to add JavaScript code, but in this case we already can write HTML like this onClick=" alert('Hi') "
so why this is not working?