Sunday, July 11, 2021

Initiate a project in React (using create-react-app)

 1- In your terminal, make sure you have node and npm installed

for node:

node -v

for npm:

npm -v


2- Create the "bare bones" project by using:

npx create-react-app my-custom-project

where: my-custom-project is your project's name


3- Here’s the purpose of each file:

index.js pulls all pieces together: from all the different js files or "components" you've created and inserts/injects them into the specified element (#root by default)

ReactDOM.render(
<App />,
document.getElementById('root')
);

App.js is the default/sample "component" which is imported into index.js by using

import App from './App';

No comments:

Post a Comment