What exactly is the the 'react-scripts start' command?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


What exactly is the the 'react-scripts start' command?



I've been working with a React project, using react-create-app, and I have two options to start the project:


react-create-app



First way:



npm run start with the definition at the package.json like this:


npm run start


package.json



"start": "react-scripts start",


"start": "react-scripts start",



Second way:



and npm start


npm start



What is the difference between these two commands? And what is the purpose of the react-scripts start?


react-scripts start



I tried to found the definition, but I just found a package with the name, and I still don't know what is the meaning of this command.





are you using create-react-app? seems like its a scripts related to that specific project
– Sagiv b.g
Jun 6 at 13:49





@Sagivb.g yes, I updated my question
– Felipe Augusto
Jun 6 at 13:51





"start" is a name of a script, in npm you run scripts like this npm run scriptName, npm start is also a short for npm run start
– Sagiv b.g
Jun 6 at 13:52


npm


npm run scriptName


npm start


npm run start





react-scripts start is the proper command to run the React app in dev mode. This command is stored in package.json so you don't have to memorize it and may simply type the usual npm run start instead. npm start is a shortcut for the latter.
– Chris G
Jun 6 at 13:55


react-scripts start


npm run start


npm start




2 Answers
2



react-scripts is a set of scripts from the create-react-app starter pack. create-react-app helps you kick off projects without configuring, so you do not have to setup your project by yourself.


react-scripts


create-react-app



react-scripts start sets up the development environment and starts a server, as well as hot module reloading. You can read here to see what everything it does for you.


react-scripts start



with create-react-app you have following features out of the box.



npm start is a shortcut for npm run start.


npm start


npm run start



npm run is used to run scripts that you define in the scripts object of your package.json


npm run


scripts



if there is no start key in the scripts object, it will default to node server.js


start


node server.js



Sometimes you want to do more than the react scripts gives you, in this case you can do react-scripts eject. This will transform your project from a "managed" state into a not managed state, where you have full control over dependencies, build scripts and other configurations.


react-scripts eject



"start" is a name of a script, in npm you run scripts like this npm run scriptName, npm start is also a short for npm run start


npm run scriptName


npm start


npm run start



As for "react-scripts" this is a script related specifically to create-react-app






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived