如何使用最新的 React 版本 (react18)?

How can I use the latest react version (react18)?

当使用 npx create-react-app my-app 时,我得到了这个错误:

You are running create-react-app 4.0.3, which is behind the latest release (5.0.1). We no longer support global installation of Create React App. Please remove any global installs with one of the following commands: - npm uninstall -g create-react-app - yarn global remove create-react-app

我使用了命令 npm uninstall 并检查了 getting started with react

但该链接暗示了相同的过程 npx create-react-app 我的应用程序。我也使用了这个命令 npm install react react-dom 但是这个
只安装一个节点模块和一个package.json。它不会创建通常的反应样板 和所有。谁有什么想法,请帮忙。

试试这个解决方案:

npx create-react-app@latest myApp