Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should you run the 'yarn start' command while working on a React project?

I'm having trouble finding much documentation on this command.

Say you are working on another person's React app, have unzipped it to your desktop and run 'yarn install' to get the dependencies. You are about to make some additions to the code. Is this when you run 'yarn start'?

I was given these instructions:

"Go to your terminal and navigate to the root folder of the extension. Type yarn start, this will make a build folder within the root folder. Stop that operation (on a mac it’s ctrl-c) and then build the updated version."

To me, this sounds sort of like I'm supposed to make the edits, then run 'yarn start', stop the operation and run the build command in quick succession. However, I was under the impression 'yarn start' is what you run in the beginning, before you start working on the React code.

Can someone set this straight for me? At what point in this process does 'yarn start' come into play?

Thank you!

like image 477
John Deacon Avatar asked Jun 08 '26 07:06

John Deacon


2 Answers

It's a predefined command in your package.json

It will look like this:

in your package.json

{
  "scripts": {
    "start": "terminal go do something"
  }
}
like image 70
Joseph Wang Avatar answered Jun 10 '26 17:06

Joseph Wang


As per this,

Go to your terminal and navigate to the root folder of the extension. Type yarn start, this will make a build folder within the root folder. Stop that operation (on a mac it’s ctrl-c) and then build the updated version.

it is clear that your yarn start command is building your application.

Building your application means it bundles your js, css & assets files to a single chunk file which can be run in production.

Coming back to your question, when to run yarn start.

So whenever you done with your changes and ready to go live then you call this command which will give you a updated build folder for production.

like image 42
ravibagul91 Avatar answered Jun 10 '26 17:06

ravibagul91