Skip to content

Instantly share code, notes, and snippets.

@juhahinkula
Last active August 28, 2023 06:26
Show Gist options
  • Save juhahinkula/a3d6960491d23fa5903d9c3b084a7fc8 to your computer and use it in GitHub Desktop.
Save juhahinkula/a3d6960491d23fa5903d9c3b084a7fc8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>React getting started</title>
</head>
<body>
<!-- Root container for react components -->
<div id="root"></div>
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js"></script>
<script type="text/babel">
function Counter() {
const [count, setCount] = React.useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>+</button>
</div>
);
};
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<div><Counter /></div>);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment