CRA (create-react-app)

CRA (create-react-app)

ReactJS
ReactJS

Create React App aka CRA, is a javascript based command-line tool developed by Facebook and open source community to create a basic pre-configured starter boilerplate for a react application from where one can start development.


Explanation

CRA is a command-line tool that most of the react developers use. It does the basic configurations for you and gives you a starting point from where you can start coding. The boilerplate generated by it gets updated from time to time. Below is an example of how you can use CRA to create your new react app.

npx create-react-app my-app 
cd my-app 
npm start

There are many things that you have to set up that is required by React, like setting up Webpack, Babel, service workers, etc. All of them are pre-configures to some default in it. It creates multiple files, in a particular structure as shown below.

my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
    ├── App.css
    ├── App.js
    ├── App.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    └── serviceWorker.js
    └── setupTests.js

And in here your app begins from index.js, which renders App.js that contain some intro code as shown below.

create-react-app-welcome-page

© 2020 Garbage Valuegarbage value logo