背景
Reactを勉強するにあたり、まずはReactプロジェクトを作成する必要があるので、
Viteでプロジェクト作成をした
前提
- Nodeはインストールされている
やってみた
プロジェクトのコマンド
npm create vite hello-world -- --template react-ts
- プロジェクト名は、
hello-world
- テンプレートに
react-ts
を指定して、React&TypeScriptとしてみた
- プロジェクト名は、
実行した
PS C:\react-study> npm create vite hello-world -- --template react-ts Scaffolding project in C:\react-study\hello-world... Done. Now run: cd hello-world npm install npm run dev PS C:\react-study>
- 実に簡単でした。
記載されている通り、
cd hello-world/npm install/npm run dev
する- 秒で起動するので、 記載されているURLにブラウザでアクセスすると、初期画面が表示されました。
ご注意
npm create vite
コマンドの実行は、npmのバージョン等で方言が微妙にあるそうなので、ご注意ください。- 詳細は、 こちら( https://vitejs.dev/guide/ ) を参照ください。
最後に…
Reactの勉強がてら、気付きがあれば、記事書いていきます。 ではでは…