<main></main>

<p class='debug'></p>
const $debug = $('.debug');
let renderCount = 0;

function Hello(props) {
  $debug.text(`Renders: ${++renderCount}`);
  return (<p>Hello {props.name}</p>);
}


class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {ticks: 0};
    this.tick = this.tick.bind(this);
  }
  
  tick() {
    this.setState({ ticks: this.state.ticks + 1 });
  }
  
  render() {
    return (
      <div>
        <Hello name="ynon" />
        <button onClick={this.tick}>{this.state.ticks}</button>
      </div>
    )
  }
}

ReactDOM.render(<App />, document.querySelector('main'));
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/16.6.0/umd/react.production.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.0/umd/react-dom.production.min.js
  3. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js