如何在旧版React上使用create-react-app? [英] How to use create-react-app with an older React version?
本文介绍了如何在旧版React上使用create-react-app?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在将 create-react-app 与
When using create-react-app with custom-react-scripts I always end up with React 16 (latest) installed. Is there a way to create a new project with an older version, like React 15?
推荐答案
似乎您可以继续使用它来生成React 16应用,然后编辑package.json并运行 npm i
(或 npm install
; npm i
只是一个快捷方式).
It seems that you can just go ahead and use it to generate a React 16 app, then edit package.json and run npm i
(or npm install
; npm i
is just a shortcut).
我只是将 react-scripts
版本保留为最新版本,只更改了 react
和 react-dom
的版本,工作:
I just left the react-scripts
version at the latest version and only changed the versions of react
and react-dom
, and it worked:
"devDependencies": {
"react-scripts": "1.0.14"
},
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
这篇关于如何在旧版React上使用create-react-app?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文