Last active
August 28, 2023 06:26
-
-
Save juhahinkula/a3d6960491d23fa5903d9c3b084a7fc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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/[email protected]/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