Mis à jour le mardi 7 mars 2017
  • 20 heures
  • Difficile

Ce cours est visible gratuitement en ligne.

Ce cours est en vidéo.

Vous pouvez obtenir un certificat de réussite à l'issue de ce cours.

J'ai tout compris !

Use 'create-react-app' to build your React app

Connectez-vous ou inscrivez-vous gratuitement pour bénéficier de toutes les fonctionnalités de ce cours !

We're going to be using the command line on your local machine to build your first React app. To do this, you're going to have to install Nodejs, and a few libraries, if you don't already have them.

Nodejs

First off, the perpetually-popular Nodejs!

Nodejs
Nodejs

Go to the package-manager install page for node.js, select your operating system, and follow the instructions to download and install Nodejs on your computer.

After you've done that, make sure that Nodejs is running on your system. Depending on what kind of machine you are using, you may need to open a new terminal window, or re-source your shell. You'll know you've got it working if you can type

node --help

at the prompt and get a list of commands and their descriptions! ✅

Installing Yarn

Yarn is a package manager for Nodejs. Were going to use it install create-react-app and get ourselves set up with a working React application.

Go to the installation page for the yarn project and select the tab for your operating system. Follow the instructions there to install Yarn on your machine.

Installing create-react-app

Now that that's out of the way, we can get back to React. With Yarn installed, run

yarn global add create-react-app

from your command line.

To test that its working, run

create-react-app --help

and make sure that it shows you a list of commands and instructions for using them.

If you don't see the expected output, something went wrong somewhere along the way, and you may need to get help setting up your environment. If so, don't be afraid to ask for help!

Create a React app!

Once you have create-react-app installed and working, think of a name for your app and run

create-react-app my-app-name

This should produce a long stream of output, beginning with a message like

Creating a new React app in...

and ending with a success message and instructions for serving your new React app.

You should see a list of files output. If you inspect your file system you should now see the contents of your brand new react app! In the next section we'll take a look at these generated files.

Ta-da, you're done with the install process!

Exemple de certificat de réussite
Exemple de certificat de réussite