搭建react + ts项目
时间: 2023-08-26 08:06:19 浏览: 247
搭建React TypeScript项目的步骤如下:
1. 使用create-react-app脚手架创建项目。在终端中运行以下命令:
```
npx create-react-app testproject --template typescript
```
这将创建一个基于React和TypeScript的项目。
2. 打开项目,并检查生成的组件文件后缀是否为.tsx。在VSCode中打开项目文件夹,确保项目成功生成,并且组件的后缀名是.tsx,这表示成功创建了React TypeScript项目的雏形。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [react+ts搭建](https://blog.csdn.net/m0_56540662/article/details/124267829)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [React + Ts项目搭建](https://blog.csdn.net/iam671/article/details/125580117)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文