Delete all files in the src/ folder of the new project
Note:
Don’t delete the entire src folder, just the original source files inside it. We’ll replace the default source files with examples for this project in the next step.
cd my-app
cd src
# If you're using a Mac or Linux:
rm -f *
# Or, if you're on Windows:
del *
# Then, switch back to the project folder
cd ..
Add a file named index.css in the src/ folder with this CSS code.
Add a file named index.js in the src/ folder with this JS code.
Add these three lines to the top of index.js in the src/ folder:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
Now if you run npm start in the project folder and open http://localhost:3000 in the browser, you should see an empty tic-tac-toe field.
Should look like this…
React DOM and JSX
We learn how to spin up the most basic React app possible using ReactDOM and touch on some key points about JSX
index.html
(this is the same throughout all example as id=root is used)
Installation using node npm
npx create-react-app my-app
cd my-app
cd src
# If you're using a Mac or Linux:
rm -f *
# Or, if you're on Windows:
del *
# Then, switch back to the project folder
cd ..
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
React DOM and JSX
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>