Creating next one page web app with React is quiet easy. To get started with React we should have the following requirements.
- Nodejs
- A IDE, Visual Studio Code (recommended) or any editor of your choice
- Internet connection
- Chrome (browser)
Create-react-app
create-react-app is a npm package for creating React project and file structure. We can install the package ,which is optional, using npm install -g create-react-app
We can start with a sample project either using npm
or npx command.
npm int create-app < Project-Name >
npx create-react-app < Project Name >
I recommend the second method and need not to worry about dependencies or create-react-app package.
Running the project
To run the project use npm start on console from the project directory, start
is a script which is configured in your package.json file. By running the command your chrome will automatically opened with localhost and showing the welcome screen of your app
Auto reloading
Do I need nodemon for auto reloading project ? . No react does it for us. It will update the UI whenever you made a change, it is an awesome UI library
No let’s try to make some change in App.js (try some HTML) and watch the result