1、
错误:.ERROR in ./src/ChargeBikeAssets.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
ReferenceError: Unknown plugin “import” specified in “C:\Users\yangdezhi\Desktop\chargebike-remake\.babelrc” at 1, attempted to resolve relative to “C:\Users\yangdezhi\Desktop\chargebike-remake”
at C:\Users\yangdezhi\Desktop\chargebike-remake\node_modules\babel-core\lib\transformation\file\options\option-manager.js:180:17
at Array.map ()
at Function.normalisePlugins (C:\Users\yangdezhi\Desktop\chargebike-remake\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (C:\Users\yangdezhi\Desktop\chargebike-remake\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
at OptionManager.init (C:\Users\yangdezhi\Desktop\chargebike-remake\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (C:\Users\yangdezhi\Desktop\chargebike-remake\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (C:\Users\yangdezhi
原因:缺少插件 babel-plugin-import
解决方法:npm install babel-plugin-import --save-dev 或 yarn add babel-plugin-import --dev
2 .使用webStrom的时候 整个页面都报错
(1) 原因:javaScript 版本问题 应将Es5 设置成React JSX
(2) 解决办法 :https://www.cnblogs.com/pizitai/p/6830470.html
3.react中componentWillReceiveProps()在props不改变的时候也可能被调用,导致页面重复渲染 修改的值赋不上
解决办法:componentWillReceiveProps 里面判断依稀 this.props和nextProps 是否相等 如果相等说明 props值没有改变,就不要setState .