Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Como integrar React.js 17 en cualquier Webpage
<!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