网上有一些的讲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