I would like to summarize the simple steps to create Hello World with React.
If you want to try React for now This is a must see for those who want to try React for the time being.
Install Node.js
Please go to Node.js official website.
LTS is the version with long term support.
The latest version has a shorter support period, but offers the latest features.
Install create-react-app
yarn global add create-react-app
Run create-react-app
create-react-app hello-react
Run yarn run start
yarn run start
Enter this command, and go to localhost:3000
.
Edit src/App.js
Let’s edit
on src/App.js
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Hello React
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
}
export default App;