React: Create React App
Create new app
npm install -g create-react-appGenerate app
jsx is name of app.
create-react-app jsxRun app
npm startApp will run at localhost:3000.
Possible errors
Port is in use - open new tab in terminal and run npm start again. You can then view your app on localhost:3001
localhost:8080 doesnt’t work - go back to terminal and search for On your network and visit that url.
index.js
// Import the React and ReactDOM libraries
import React from 'react';
import ReactDOM from 'react-dom';
// Create a react component
const App = () => {
	return <div>Hi there!</div>;
}
// Take the react component and show it on the screen
ReactDOM.render(
	<App />,
	document.querySelector('#root')
);
Div root is available in index.html.