How to Create React App Using Yarn

Advertisement

Requirements For React App with Yarn

  • Node Version >=14
  • Yarn 0.25+

You can check if you already have Node and Yarn by running node –version and yarn –version respectively.

If you don’t have Node, follow the instructions on NodeJS website.

To install Yarn, run:

npm install --global yarn

Install yarn globally

Create React App in Yarn

To create your first app, run the following command:

yarn create react-app project-name

create react app using yarn

Once the script completes running, you should have a new folder called project-name.

Get inside the folder by running:

cd project-name

Advertisement

Run React App Using Yarn

Inside the project-name folder, you should have the following files and folders. generated files and folders

To view you new react app, run:

yarn serve

run react app using yarn

Build React App Using Yarn

To build a React project using Yarn, run:

yarn build

The production build is saved in the build folder. The production build is optimized for performance.

Build react app using yarn

You can also create a React app:

  1. using NPM
  2. using Vite
  3. without using Node
author's bio photo

Hi there! I am Avic Ndugu.

I have published 100+ blog posts on HTML, CSS, Javascript, React and other related topics. When I am not writing, I enjoy reading, hiking and listening to podcasts.