Saturday, October 3, 2020

Sample React project

For React sample project

npx create-react-app .


Or, you can install the create-react-app globally.

sudo npm install -g create-react-app

Then use the below command.will create a sub folder for project hello-world

create-react-app hello-world


To run the project directly and launch the app in browser

npm start


To create static files.

npm run build



There is one more process without using the create-react-app, which contains all manual steps.

You can see it for reference.

In case you're getting an error with the code shown in the next lecture, simply assign a capitalized variable name to the variable that holds your functional component.

Example:

Use

1.   const App = () => { ... }

instead of

1.   const app = () => { ... }

Technically, that's not required but depending on your project setup, the built-in linter (a code quality checking tool) that comes with create-react-app might not like the lowercase variable name.

1.   create-react-app my-app --scripts-version 1.1.5

No comments:

Post a Comment