我正在学习ReactJS,但在所有教程中都说创建新的React应用程序的方法是这样的:
npx create-react-app //name of my app
但是这个命令创建了一个 hello world 示例。
如何在没有 hello world 示例代码的情况下创建新的 ReactJS 应用程序
npx create-react-app my-shop
您正在寻找的功能在 CRA 文档
中有描述您可以根据需要自定义您的 React 应用程序并将其推送到 github。
将来,当您想要创建新的react-app时,您只需从github存储库中克隆它即可,而不是运行“npx create-react-app”。
您可以使用 --template 标志运行 create-react-app 命令。
npx create-react-app my-app --template [template-name]
template-name
参数可以是以下值之一:
A custom --template can be one of:
- a custom template published on npm: cra-template-typescript
- a local path relative to the current working directory: file:../my-custom-template
- a .tgz archive: https://example.com/my-custom-template-0.8.2.tgz
- a .tar.gz archive: https://example.com/my-custom-template-0.8.2.tar.gz