Skip to content

Latest commit

 

History

History

babel-standalone

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

babel-standalone

A zero-build-step React project implemented with Babel's in-browser compiler @babel/standalone. This is React the CDN way.

Overview

React and Babel are loaded as script tags from a CDN (https://unpkg.com/). Babel transpiles the ESNext source code on-the-fly in the browser.

This project was originally scaffolded using the example project in the old docs incarnation of https://reactjs.org/docs/add-react-to-a-website.html. Unfortunately, the new docs (which is what the link will bring you to today) do not offer any information about using React/JSX in a browser without a build step. Or in other words, React doesn't seem to endorse React the CDN way anymore. This is a bummer.

Instructions

Follow these instructions to serve the app (rejoice in the fact that there's no build step!):

  1. Serve the source code:
    • python3 -m http.server --directory src/
    • Note: If you are on macOS then Python 3 and its built-in modules are already installed on your computer. Pretty neat way to get a simple server up and running.
  2. Open the browser!

Wish List

General clean-ups, todos and things I wish to implement for this project:

Reference