Skip to main content

Once node and npm/yarn are installed, we can get started with our first React application. To do this, open a Command Box (Windows CMD) or a Terminal Window (OSX/ Linux) and cd to the directory where you house your projects.

Then we can use npx (a special command from NPM) to create a new project in new (empty) directory:

npx create-react-app new-app

The npx command has as first parameter the create-react-app toolchain and as 2nd parameter the name of the project - which is also the directory where the application will end up.

The toolchain downloads and installs all the necessary libraries and plugins, and Babel (the "transpiler") and Webpack (the runtime environment) are also configured automatically. To test whether things actually work, we cd to the app's directory and start the app via the built-in web server:

cd new-app

yarn start
# or
npm run start

The web server automatically starts our default browser and if all goes well we see the following output (the web server runs on port 3000 of our localhost: http://localhost:3000)