Hello React React入门指南

Create React App 的开发体验挺顺的,默认配置就够你折腾一阵了,适合刚入坑 React 的你。

项目里自带的脚本也比较全,比如npm start,直接启动开发模式,响应快,页面还会自动刷新,改代码的过程丝滑。嗯,控制台还有 lint 提示,写起来放心多了。

npm test这个命令也挺实用的,配了交互式测试模式,一边写一边测挺方便的,适合习惯 TDD 的朋友。

要上线?跑npm run build就行。它会把项目打包到build文件夹里,文件名也加上了 hash,做缓存策略刚刚好。

,如果你对 CRA 那套配置不满意,也可以npm run eject。不过要注意,一旦 eject 就没法回头,配置全放你手里,适合想彻底自定义构建流程的场景。

Create React App对新手真的蛮友好,起步快、坑也少。如果你想看看更深入的,可以去看看React App Initialization with Create React App或者使用 create-react-app 入门 React,内容还挺实在的。

zip
hello-react-main.zip 预估大小:18个文件
folder
hello-react-main 文件夹
file
package.json 814B
file
package-lock.json 1.45MB
folder
src 文件夹
file
App.css 564B
file
index.js 500B
file
reportWebVitals.js 362B
file
logo.svg 3KB
file
App.test.js 246B
file
setupTests.js 241B
file
App.js 528B
file
index.css 366B
file
.gitignore 310B
folder
public 文件夹
file
logo192.png 5KB
file
manifest.json 492B
file
robots.txt 67B
file
index.html 2KB
file
logo512.png 9KB
file
favicon.ico 4KB
file
README.md 3KB
zip 文件大小:361.57KB