Create React App is the best way to start building a new React single page application. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.
$ npm install -g create-react-app
$ create-react-app todolist
If you are using older version of Node.js and npm you might get following error message.
I am also using Ghost blogging platform so I need to use 4.8 LTS version of Node.js so I will keep my current version, but if you dont have any dependency like above, please update to latest stable version.
$ create-react-app myreactapp
Creating a new React app in /home/user/code/nodejs/myreactapp.
You are using Node v4.8.3 so the project will be boostrapped with an old unsupported version of tools.
Please update to Node 6 or higher for a better, fully supported experience.
You are using npm 2.15.11 so the project will be boostrapped with an old unsupported version of tools.
Please update to npm 3 or higher for a better, fully supported experience.
Once installation is complete got to the newly created folder and start the application.
$ cd myreactapp
$ npm start
This will start development server and it will open a webpage on your default browser at following location.
This will create file structure as below: index.html provides basis div elements and index.js is primary react file which renders required components in index.js
├── package.json
├ (Node.js file structure)
├── package.json
├── public
│ ├── favicon.ico
│ └── index.html
├── README.md
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
└── logo.svg