JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
<div id="container"></div>
Babel + JSX
class App extends React.Component {
constructor() {
super();
this.state = {clicked:0};
}
componentDidMount() {
document.addEventListener('click', () => {
this.setState((prevState) => ({clicked:prevState.clicked + 1}))
});
}
render() {
return (
<div>
<h1>Hello, {this.props.name}</h1>
{this.state.clicked}
</div>
);
}
}
ReactDOM.render(<App name="world"/>, document.getElementById('container'));