react
AwD One Piece
这个作者很懒,什么都没留下…
展开
-
react学习-----render-props
render-props的使用 // 定义一个组件 child export default class Mouse extends React.Component { // 鼠标的 x, y 坐标 state = { x: 0, y: 0 }, //鼠标移动处理程序 handleMousemove = e => { this.setState({ x: e.c...原创 2020-05-07 21:05:17 · 146 阅读 · 0 评论 -
react学习之路之生命周期
创建时(挂载阶段) List item 执行顺序:constructor()、render() 、componentDidMount() 钩子函数 触发时机 作用 constructor 创建时最先执行 初始化state、为事件处理程序绑定this render 每次组件渲染都会触发 渲染UI,不能调用setState() componentDidMount 组件挂在...原创 2020-05-06 21:26:52 · 199 阅读 · 0 评论