Ubuntu20.04でReactの環境構築

### ubuntuにnodejs, npm, yarnをインストール
$ cat /etc/os-release
NAME=”Ubuntu”
VERSION=”20.04.3 LTS (Focal Fossa)”
$ sudo apt update
$ sudo apt install nodejs
$ nodejs -v
v10.19.0
$ sudo apt install npm
$ npm -v
6.14.4
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add
$ echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt install yarn
$ yarn -v
1.22.5
※yarnはrepositoryを入れないとinstallできないので注意が必要

### project作成
$ yarn create react-app hello
$ cd hello
$ yarn start

src/index.js
L 変更なし

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

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

src/App.js

function App() {
  return (
    <div className="App">
      <h1>Hello React!</h1>
    </div>
  );
}

export default App;

きゃー☺️