React JSX Playground Online Template

Code, Debug, Demo, Example and Learn Easy & Fast with React and JSX Playground Online

import React, { useState } from 'react';
import ReactDOM from 'react-dom';

const App = () => {
  const [state, setState] = useState(0);

  const handler = (event) => {
    // changing the state to the increase
    // which is pressed
    setState((prev) => prev + 1);
  };

  return (
    <div>
      <h1>Hi Geeks!</h1>      
      <button onClick={(e) => handler(e)}>Increase: {state}</button>
    </div>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));
<div id="root"></div>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

html,
body {
  font-family: 'Roboto', cursive;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  /* font-size: 30px; */
}