# 我的react **Repository Path**: pggcj/my-react ## Basic Information - **Project Name**: 我的react - **Description**: react实现源码,对react 的阅读以及实现 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-09-19 - **Last Updated**: 2025-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 安装 npm i @babel/preset-react babel-loader --save-dev npm i webpack wepack-cli html-webpack-plugin webpack-dev-server --save-dev # 配置 配置webpack和babel 配置入口js文件和模板html文件 # 起步 # 执行:npm start # 打包:npm run build # 功能 # setState # refs # context # Fragments # Protal # render.props # PureComponent # 生命周期 willMount、didMount、willUpdate、didUpdate、willUnMount、shouldUpdate # useState # useRudex # 注意 # 不要在 组件 的render的 return 中写类似 console.log 的代码,如果需要打印,可以在 return 的外部打印 # shouldUpdate 在非顶级组件时可以通过 this 获取到 oldProps 和 oldState,通过它们和 nextProps、nextState 对比决定是否更新 # 提示 # render 即使在 shouldUpdate 或 PureComponent 中都会执行