Created
March 4, 2021 06:49
-
-
Save porfidev/22f88b982d3f2b3862b9e43914aa8bd8 to your computer and use it in GitHub Desktop.
Como integrar React.js 17 en cualquier Webpage
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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>React en 1 minuto</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script | |
src="https://unpkg.com/react@17/umd/react.development.js" | |
crossorigin | |
></script> | |
<script | |
src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" | |
crossorigin | |
></script> | |
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | |
<script type="text/babel"> | |
const { useState } = React; | |
const App = () => { | |
const [counter, setCounter] = useState(0); | |
return ( | |
<div> | |
<h1>Hola React.js</h1> | |
<button onClick={() => setCounter(counter + 1)}> | |
Presioname 😆 | |
</button> | |
<div>Contador de clicks: {counter}</div> | |
</div> | |
); | |
}; | |
ReactDOM.render(<App />, document.getElementById("root")); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment