Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add React in One Minute
<!DOCTYPE html>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
<p>React is loaded as a script tag.</p>
<!-- We will put our React component inside this div. -->
<div id="like_button_container"></div>
<!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="" crossorigin></script>
<script src="" crossorigin></script>
<!-- Load our React component. -->
<script src="like_button.js"></script>
'use strict';
const e = React.createElement;
function LikeButton() {
const [liked, setLiked] = React.useState(false);
if (liked) {
return 'You liked this.';
return e(
{ onClick: () => setLiked(true) },
const domContainer = document.querySelector('#like_button_container');
ReactDOM.render(e(LikeButton), domContainer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment