網上有一些的講react15升級到react16升級的教程。可是不多從總體講,都是從單個知識點講。不少都是隻講react自己的升級,如:PropTypes 引用從react模塊改爲單獨的prop-types模塊。可是通常項目的架構都是:react+react-router+redux+react-redux+react-router-redux。因此本身整理一下完整的升級過程。react
react15升級到react16涉及如下幾個方面:webpack
if (env === 'development') { // _loaders.unshift('react-hot'); }
"plugins": [ "react-hot-loader/babel" ]
React-PropTypes-to-prop-types.jsgit
npm install global add jscodeshift
, this will add jscodeshiftreact-codemod && npm install cd ..
jscodeshift -t <codemod-script> <path>
to transform your deprecated code. For example, if you want to fix prop-types errors in jsx files in the components directory, you can run something like: jscodeshift -t react-codemod/transforms/React-PropTypes-to-prop-types.js app/components/**/*
react-redux@5.0.6
版本以上github
react-router@3.2.0
版本以上web