Getting Started

Create react app…

npx create-react-app my-app

This will launch the create project in directory my-app. This creates a basic folder structure.

pathdescription
/node_modulesholds our dependancies
index.htmlholds our div that everything loads into
/srcholds source code for our components
/publicholds static content

Once you have generated the project you can fire up the dev server with…

npm run start

If you ever need to create or recreate the node_modules folder you can run…

npm install

index.js

index.js kick starts your application. In the starter project it includes the App component that lives in App.js

Creating Components

Components contain templates and logic. Babel converts JSX into the html and javascript.

Starting with react 17 you no longer need to import react in your components.

Styling Components with CSS

To apply CSS styles use className instead of class when working with an HTML elements you wish to style.

<div className="myCustomClass">