Update: This was written before create react app came out. Use that, it’s awesome.
The overly complex tutorials for webpack pissed me off for the last time. Just clone this. https://t.co/H7ozaDlvwN— Jack Reichert (@JackReichert) March 12, 2016
I was annoyed by how many people are trying to sound smart in their tutorials, and thus not really helping anything. I wanted a simple “Here is what you need to get started” tutorial and lost a day chasing rabbits down broken holes.
So I wrote this. This is all you need.
Download this github repo for React/weback:
git clone [email protected]:jackreichert/react-webpack.git cd react-webpack npm install
Which will install the node dependencies for the project.
Which will compile the “Hello World” example.
Now run your favorite static server in the public/ folder.
For example, if you’re on a mac you can run:
python -m SimpleHTTPServer
In your browser go to http://localhost:8000/.
What’s happening here?
When you ran
npm install it installed the babel transpiler, React, ReactDOM, and webpack.
When you ran
webpack it followed the config instructions (see comments there for more details).
That’s it. Now you can get started with React without the headache of trying to figure out how to start getting started. Of COURSE there’s a lot more you can do. But you have to start somewhere. Once you have your tools up and running you can figure out the hard stuff in your own time.