Typescript和React结合项目初始化

 https://create-react-app.dev/docs/getting-started/

npm uninstall -g create-react-app
npx create-react-app my-app

https://www.jianshu.com/p/7e90bfbb7640(旧版本的create-react-app 导致创建工程失败)

 https://zhuanlan.zhihu.com/p/79107473(React-Typescript项目初始化)

npx create-react-app typescript-react-app --template typescript

运行npm start之后

 .ts文件表示typescript代码,而.tsx文件则表示react代码,不见js代码。。

用VScode打开项目文件夹

这个.html文件只有在发布时才会出现吗。。。开发时基本上用不到?

TypeScript与React结合的一些注意点:https://zhuanlan.zhihu.com/p/88604372

原文地址:https://www.cnblogs.com/2008nmj/p/14986964.html