I am trying to create a new React project using yarn command on Windows.
I have tried the commands
yarn init
and yarn add react react-dom
. But it is only adding a few of the node modules to the project I created. And package.json contains only this many dependencies
{
"name": "sample",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2"
}
}
How can I add all the other dependencies and node modules before starting the project?
I would recommend "create-react-app", simply "CRA". "CRA" handles the most of the build configurations and they are hidden by default so you can focus on code. ( In some specific cases, you can eject and customize it by running commands "eject")
You can create the project using below command
yarn create react-app my-app
To start the project simply run below commands
yarn start
To build projects
yarn build
You can eject the project with below command
yarn eject
Please reference this link for more details. https://github.com/facebook/create-react-app