Deploying a project

To build a project for production deployments, we simply run the build script:

  1. Run the following command to build the project for production deployment:
> npm run-script build
Using yarn, we can simply run yarn build. Actually, we can run any package script that does not conflict with the name of an internal yarn command in this way: yarn <script-name>, instead of npm run-script <script-name>.
  1. We can then serve our static build folder with a web server, or by using the serve tool. First, we have to install it:
> npm install -g serve
  1. Then, we can run the serve command, as follows:
> serve -s build
The -s flag of the serve command rewrites all not-found requests to index.html, allowing for client-side routing.

Now, we can access the same app by opening http://localhost:5000 in our browser. Please note that the serve tool does not automatically open the page in your browser.

After learning about create-react-app, we are now going to write our first component with React.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.10.137