跳到主要内容

Create React App with TypeScript

备注

npm package create-react-app is not under maintained, but it's very helpful for starters.

Installation

yarn create react-app react-typescript-app --template typescript && cd react-typescript-app
do not use globally

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

Global installs of create-react-app are no longer supported.

File Structure

.
├── node_modules
│ ├── ...
│ ├── ...
│ └── ...
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
├── src
│ ├── App.css
│ ├── App.test.tsx
│ ├── App.tsx
│ ├── index.css
│ ├── index.tsx
│ ├── logo.svg
│ ├── react-app-env.d.ts
│ ├── reportWebVitals.ts
│ └── setupTests.ts
├── package-lock.json
├── package.json
├── README.md
└── tsconfig.json