1. 修改package.json,新增需要安裝的包
,"keywords": ,
"author": "",
"license": "isc",
"devdependencies": ,
"dependencies":
}2. 執行 npm i ,安裝。
3. 修改webpack.config.js
const path = require('4. 在根目錄建立.eslintrc檔案path');
const htmlwebpackplugin = require('
html-webpack-plugin');
const cleanwebpackplugin = require('
clean-webpack-plugin');
const webpack = require('
webpack');
module.exports =,
devtool:
'inline-source-map',
devserver: ,
mode:
'development',
output: ,
plugins: [
new cleanwebpackplugin(['
dist
']),
newhtmlwebpackplugin(),
newwebpack.hotmodulereplacementplugin()
],module:
]}};
],5. 在根目錄建立.babelrc檔案 6. 修改index.js"react/jsx-no-bind
": [0
],
"react/prefer-stateless-function
": [0
],
"react/prop-types
": [0
],
"require-yield
": [1
],
"no-unused-vars
": [0
],
"space-infix-ops
": [0
],
"object-shorthand
": [0
],
"quotes
": 0,//
[1, "single"],
"jsx-quotes
": 0
,
"prefer-const
": [0
],
"indent
": [2, 4
],
"react/jsx-indent
": [1, 4
],
"curly
": [1, "
all"
],
"comma-dangle
": [2, "
never"],
"react/jsx-indent-props
": 0
,
"react/jsx-curly-spacing
": 0
,
"space-in-parens
": 0
,
"no-irregular-whitespace
": 2
,
"no-mixed-spaces-and-tabs
": [2, false
],
"no-underscore-dangle
": 1
,
"key-spacing
": 0
,
"no-param-reassign
": 0
,
"no-lonely-if
": 0
,
"linebreak-style
": 0
,
"max-len
": [2, 300
],
"class-methods-use-this
": 0
,
"quote-props
":0,
"no-shadow
": 0
,
"guard-for-in
": 0
,
"no-labels
": 0
,
"prefer-template
": 0
,
"react/sort-comp
": 0
},
"parseroptions":
},"env":
}
import react from7. 在根目錄新建public資料夾,將index.html移動到該檔案下'react';
import reactdom
from
'react-dom';
import
from
'react-router-dom';
class
render()
}reactdom.render(
document.getelementbyid(''
),)
"en8. 執行 npm start ,瀏覽器顯示頁面">"
">
React 實踐專案 (四)
react在github上已經有接近70000的 star 數了,是目前最熱門的前端框架。而我學習react也有一段時間了,現在就開始用 react redux 進行實戰!上回說到使用redux saga 管理 redux 應用非同步操作,應用還是只有乙個首頁.現在開始構建乙個新的投稿頁面並使用 r...
React 實踐專案 (四)
react在github上已經有接近70000的 star 數了,是目前最熱門的前端框架。而我學習react也有一段時間了,現在就開始用 react redux 進行實戰!上回說到使用redux saga 管理 redux 應用非同步操作,應用還是只有乙個首頁.現在開始構建乙個新的投稿頁面並使用 r...
React專案實踐系列一
專案建立於2018年1月底,到現在已經接近半年,在此寫下半年來專案的實踐過程以及自己對前端的學習與體悟。技術選型 框架 react 路由 react router 4 狀態管理 redux ui元件庫 ant design 搭建工程 首先我們並不打算將react讓webpack打包,而使用第三方的c...