Start a React app with create-react-app
There are many ways to get started developing a React application. A quick search on GitHub shows there are quite a few React starters.
The easiest way to get started with React is through the official Create React App command line tool. Create React App is React’s official command line method.
Node version 4.0+ is the only need to get started. To install Create React App, run this command:
npm install -g create-react-app
Once installed, getting a new React app set up is as easy as running this command:
Running this command in your terminal, should look something like this:
Rails developers may think the output is like running
rails new. The script starts by creating a folder for the new application. Then it installs some dependencies. Finally, it lays out some commands to get started.
Now it’s possible to go into the directory for the new app and fire it up. Use this command in your shell:
cd condos-great-app npm start
Starting the app should display this in the shell.
It should also open the computer’s default browser. The default for the React app will look like this:
With the basic setup running, it’s time to start adding components to the app.