JSFiddle - React, Tailwind, and code Playground

by dgmouris

HTML

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
    div {
      margin-top: 50px;
    }
    p {
      font-family: "Arial";
      font-size: 20px;
      
    }
    button {
      padding: 10px;
      font-size: 20px;
      background-color: darkgrey;
    }
  </style>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  
  <div id="react-container">
  </div>

  <!-- 
    Take look below to learn more about events
    https://reactjs.org/docs/events.html
  -->
  
  <!-- React -->
  <script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
  </body>
</html>
</body>
</html>

React

// 

const App = () => {
  const [clicked, setClicked] = React.useState(0);
  
  const clickHandler = (event) => {
    let newClickedValue = clicked + 1;
    setClicked(newClickedValue);
  }
  
  return (<div>
      <p>clicked {clicked} times </p>
      <button
         onClick={clickHandler}>
          Ultimate Clicker
      </button> 
    </div>);
}



const domContainer = document.querySelector("#react-container");
ReactDOM.render(<App/>, domContainer);