Next.js&Redux-saga(1)-プロジェクト設定
3137 ワード
プロジェクトの設定プロジェクトcreate-next-app生成 redux-toolkitおよびredux-sagaインストール eslint&きれいな取り付け .eslintrc.json typescript eslint vscode設定-macベース
vsコードにファイルを保存するたびにコードが自動的に変更されるように設定します.
commad+をクリックしてワークスペースに入り、設定します.json作成後設定ファイル Postcss & Tailwindcss の簡単なapiに必要なデータを要求します.jsonファイル の生成
準備ができました.
yarn create react-app next_prac --template typescript
yarn add @reduxjs/toolkit react-redux redux redux-saga @types/react-redux next-redux-saga next-redux-wrapper typesafe-actions axios
yarn add prettier eslint-plugin-prettier eslint-config-prettier -D
yarn add eslint-config-airbnb-base eslint-plugin-import -D
{
"plugins": ["prettier"],
"extends": [
"airbnb",
"plugin:prettier/recommended",
"next/core-web-vitals"
],
"rules": {
"prettier/prettier": "error"
}
}
アプリケーションyarn add eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react --D
yarn add prettier eslint-config-prettier eslint-plugin-prettier -D
vsコードにファイルを保存するたびにコードが自動的に変更されるように設定します.
commad+をクリックしてワークスペースに入り、設定します.json作成後設定ファイル
{
"editor.formatOnSave": false,
"[javascript]": {
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init -p
インストールと設定ファイルを作成した後、pagesフォルダのapp.次のコードをtsxに追加import 'tailwindcss/tailwind.css';
json-serverを使用して{
"boards": [
{
"title": "qwe",
"name": "zxc",
"comment": "asd",
"id": 18
},
{
"title": "qweqwe",
"name": "zxc",
"comment": "asd",
"id": 21
},
{
"title": "qasdasd",
"name": "zxczxc",
"comment": "qwe",
"id": 24
},
{
"title": "qew",
"name": "asdsad",
"comment": "qweewq",
"id": 27
},
{
"title": "게시판",
"name": "게시판",
"comment": "게시판",
"id": 28
}
]
}
nextjsサーバは3000ポートに設定されているため、サーバは4000ポートで実行されます.npx json-server ./data.json --port 4000
その後、http://localhost:4000/board道。であればCRUD機能を使用することができる.準備ができました.
yarn dev
コマンドnextjs localhost:3000で実行Reference
この問題について(Next.js&Redux-saga(1)-プロジェクト設定), 我々は、より多くの情報をここで見つけました https://velog.io/@endol007/Next.js-Redux-saga1-프로젝트-설정テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol