Have you heard of Create React App? It’s a tool for bootstrapping React apps. Better than a boilerplate where you have to manage the dependencies yourself, Create React App (a.k.a. CRA) contains all the Webpack magic and build scripts. It’s one command to generate a project, and then all you need to do to create a production-ready JS bundle is run
npm run build.
Now, how can you get that app live on the internet?
- Set up a VPS, configure nginx, and
scpup the files. (“30 minutes”, but probably like 4 hours)
- Configure an Amazon S3 bucket and then set it up correctly to serve a single-page app? (10-30 minutes)
- Just use Surge. (27 seconds)
Deploying an app to Surge is insanely easy, and it’s even free (including a custom domain and SSL).
Here’s a 27-second video:
Here are the steps:
(This assumes you already have an app created with Create React App)
- Install Surge:
- Run the Create React App build:
- Switch into the
- Run Surge, and follow the prompts. All it needs is an email and a password, and you can optionally specify a different domain name.
- Go to the URL it prints out. For instance, http://lively-payment.surge.sh/.
Learning React can be a struggle — so many libraries and tools!
My advice? Ignore all of them :)
For a step-by-step approach, check out my Pure React workshop.
Learn to think in React
- 90+ screencast lessons
- Full transcripts and closed captions
- All the code from the lessons
- Developer interviews
Dave Ceddia’s Pure React is a work of enormous clarity and depth. Hats off. I'm a React trainer in London and would thoroughly recommend this to all front end devs wanting to upskill or consolidate.