Ciro Santilli OurBigBook.com  Sponsor 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
web-cheat/react/hello-without-jsx.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
</head>
<body>
<p><a href="https://cirosantilli.com/react">https://cirosantilli.com/react</a></p>
<div id="root"></div>
<script>
class Main extends React.Component {
  constructor(props) {
    super(props);
    console.log('Main.constructor');
    this.state = {n: 0};
    this.handleClick = this.handleClick.bind(this);
  }

  handleClick() {
    console.log('Main.handleClick');
    this.setState((state, props) => ({
      n: state.n + 1
    }));
  }

  render() {
    console.log('Main.render');
    return React.createElement('div', null,
      React.createElement("div", { onClick: this.handleClick }, "Click me"),
      React.createElement("div", null, this.state.n),
      React.createElement("div", null, Math.floor(this.state.n / 2))
    );
  }
}

ReactDOM.render(
  React.createElement(Main, {}, null),
  document.getElementById('root')
);
</script>
</body>
</html>