摘要: render阶段做了什么 通过React.CreateElement,生成新的state和props,得到新的element对象。接下来,会对比这一次和上一次渲染的Virtual DOM,只在真正的DOM树中修改差别的部分。 控制render的方法 主要通过两种方式: 从自身控制是否render。如 阅读全文
posted @ 2021-12-10 11:14 webLion200 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 只讲解新版本context,v16.3以后版本 类组件和函数组件只在consumer上有区别。 const ThemeContext = React.createContext(null) // 主题颜色Context const theme = { //主题颜色 dark:{ color:'#18 阅读全文
posted @ 2021-12-10 11:12 webLion200 阅读(49) 评论(0) 推荐(0) 编辑