摘要: 常见的代码逻辑优化处理 多条件判断 // bad function filter(type) { if (type 1 || type 2 || type 3 || type 4 || ...) { console.log('条件成立了...') } } // good const types = 阅读全文
posted @ 2020-11-18 01:21 小菜菜爱吃菜 阅读(466) 评论(0) 推荐(0) 编辑
摘要: react中的虚拟dom,本质上是一种对象形式到dom的描述,虚拟dom的操作是在js层面的计算,如果把js映射生成真实的dom 调用生命周期中的render方法,生成虚拟dom,然后再调用reactDom.render方法,实现虚拟dom的真实dom转换 组件的再次更新,会再次调用render方法 阅读全文
posted @ 2020-11-18 01:19 小菜菜爱吃菜 阅读(1074) 评论(0) 推荐(0) 编辑