Creating and running a React app

Now that we have Node.js and the code editor installed, we are ready to create our first React.js app. We are using Facebook's create-react-app command (https://github.com/facebook/create-react-app) for this. Here are the steps  you need to follow in order to make your first app:

  1. Open PowerShell or the Command Prompt tool and type the following command: 
npx create-react-app myapp

This command creates a React app named myapp. Npx is the npm package runner and, when you're using it, you don't have to install the package before running it:

  1. Once the app has been created, move it into your app folder:
cd myapp
  1. Then, we can run the app with the following command. This command runs the app in port 3000 and opens the app in a browser:
npm start
  1. Now, your app is running, and you should see the following page in your browser. The npm start command starts the app in development mode:

You can stop the development server by pressing Ctrl + C in PowerShell.

To build a minified version of your app for production, you can use the npm run build command, which builds your app in the build folder.

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

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