LoginSignup
0
0

More than 1 year has passed since last update.

Reactの「create-react-app」での手順(覚書)

Last updated at Posted at 2022-10-31

公式ドキュメントはnpmでの作り方が載っています。
でも、私はyarnで管理する方が安定しました。
下の方にyarnでの作り方を書いてます。

npmの場合

npx create-react-app プロジェクト名
cd プロジェクト名
npm start

1行目:Reactアプリを作成するフォルダの指定
2行目:フォルダ移動(パッケージ管理npmは自動でインストールされている)
3行目:ローカルサーバーを立ち上げ

「npm start」から抜け出すのは、「Ctl + c」

npm install -g npm
npm init

npmを最新アップデートしておく

npm install --save react-modal @types/react-modal
npm i axios
npm install react-icons
npm install react-scroll
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

コンポーネント類インストール

▶デプロイ(サーバーにアップロード)する前
npm run build
npm run deploy

1.ソースコードを表示用に吐き出す
2.指定のURL(package.json内)にデプロイする

yarnの場合

yarn create react-app プロジェクト名
//ts
yarn create react-app --template typescript

1.javascript
2.Typescript

yarn upgrade

yarnを最新アップデートしておく

▶yarnをグローバルインストしておく方法
yarn add -g create-react-app
//js
create-react-app プロジェクト名
//ts
create-react-app プロジェクト名 --template typescript
cd プロジェクト名
yarn start

1.yarnをグローバルインスト
2.jsで作成の場合(2でやる場合は3はしない)
3.tsで作成の場合(3でやる場合は2はしない)
4.フォルダ移動
5.ローカルサーバーを立ち上げ

yarn add パッケージ名

パッケージインスト

package.jsonの中

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0