摘要: 1,关于公共组件逻辑的抽离 mixin。已被弃用 高阶组件 HOC:不是一个功能,而是一种模式。封装了公共逻辑,抛出原组件。 Render Props:将class组件中的state,作为props,传递给函数组件。 与HOC的区别,用函数包裹,返回一个新组件。 阅读全文
posted @ 2020-12-18 15:56 毛栗的demo 阅读(166) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-12-17 16:13 毛栗的demo 阅读(83) 评论(0) 推荐(0)
摘要: 场景:SPA?如果是要打包多页面应用。不同页面引用不同js 1,entry:{ app:.., other } 2, output : { filename: [name].[contentHash].js } 3, plugins: [ new HtmlWebpackPlugin({ templa 阅读全文
posted @ 2020-12-16 16:44 毛栗的demo 阅读(139) 评论(0) 推荐(0)
摘要: 1,拆分配置 和 merge 2,启动本地服务 3,处理ES6 babel 4,处理css:loader style-loader css-loader postcss-loader 兼容性 5,处理图片 阅读全文
posted @ 2020-12-16 16:29 毛栗的demo 阅读(96) 评论(0) 推荐(0)
摘要: #keepalive_timeout 0; keepalive_timeout 65; keepalive_requests 100; gzip on; gzip_min_length 1k; gzip_comp_level 6; gzip_types text/plain application/ 阅读全文
posted @ 2020-12-16 15:22 毛栗的demo 阅读(98) 评论(0) 推荐(0)
摘要: 一对多的关系(发布,订阅) 1,一个按钮,绑定多个相同的点击事件。 2,一个promise 绑定多个then 3,jquery 4,vue中的watch 5,vue和react中的生命周期 阅读全文
posted @ 2020-12-07 20:13 毛栗的demo 阅读(61) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-12-07 17:50 毛栗的demo 阅读(108) 评论(0) 推荐(0)
摘要: 1,useEffect 会在每次渲染后(包括挂载,更新)都执行,DOM更新完毕。 2,useEffect区别: 3,useEffect如何在 componentWillUnmount 清除计时器,监听事件等。 阅读全文
posted @ 2020-12-07 17:47 毛栗的demo 阅读(81) 评论(0) 推荐(0)
摘要: 1,hook 采用了js的闭包特性,可以在函数内 调用state。 2,useState 运用的是数组结构的方式定义变量。 阅读全文
posted @ 2020-12-07 17:38 毛栗的demo 阅读(71) 评论(0) 推荐(0)
摘要: 1, React 默认:父组件有更新,子组件则无条件也更新!!! 2, 性能优化对于 React 更加重要! 3, shouldComponentUpdate 一定要每次都用吗?—— 需要的时候才优化 4,shouldComponentUpdate 一定要配合不可变值一起使用。如果没有使用不可变值, 阅读全文
posted @ 2020-12-07 16:14 毛栗的demo 阅读(128) 评论(0) 推荐(0)