返回博主主页
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 29 下一页
摘要: 与https://blog.csdn.net/u010513497/article/details/50961042结果一致。 与https://blog.csdn.net/shuijianbaozi/article/details/52994525不一致,可能是设置fragment的方式不一样。 阅读全文
posted @ 2022-02-16 22:28 懒惰的星期六 阅读(70) 评论(0) 推荐(0)
摘要: shouldComponentUpdate() shouldComponentUpdate(nextProps, nextState) 根据 shouldComponentUpdate() 的返回值,判断 React 组件的输出是否受当前 state 或 props 更改的影响。默认行为是 stat 阅读全文
posted @ 2022-02-15 21:00 懒惰的星期六 阅读(72) 评论(0) 推荐(0)
摘要: https://blog.csdn.net/qq_24147051/article/details/108049705 中断或取消 Promise 链 Promise 已经成为了 JavaScript 管理异步操作的重要工具之一. 然而, 有的时候还是会很头痛: Promise // 等价于 `Pr 阅读全文
posted @ 2022-02-14 15:56 懒惰的星期六 阅读(474) 评论(0) 推荐(0)
摘要: test () { const f = (param) => new Promise((resolve, reject) => { setTimeout(resolve, param, param) }) const f2 = (param) => new Promise((resolve, rej 阅读全文
posted @ 2022-02-14 15:48 懒惰的星期六 阅读(405) 评论(0) 推荐(0)
摘要: export type Dispatcher = { useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>], useReducer<S, I, A>( reducer: (S, A) => S, in 阅读全文
posted @ 2022-02-13 21:19 懒惰的星期六 阅读(75) 评论(0) 推荐(0)
摘要: 笔记: 1. mapStateToProps中,使用state._time.xxx的原因是,_time是reducer函数的名字。 // 这是我们的 select 函数, 它会把我们需要在属性 (prop) 中对我们的组件暴露的数据从 state 中抽离出来 const mapStateToProp 阅读全文
posted @ 2022-02-13 14:01 懒惰的星期六 阅读(86) 评论(0) 推荐(0)
摘要: var a = (x,y,z)=>{ } console.log(a.length) // 3 //legnth:返回函数形参的个数,不包括rest参数的和赋值的形参 let f = (a,b,c,d,g,f=10,...e) => console.log(f.length);//5 f() 阅读全文
posted @ 2022-02-12 20:40 懒惰的星期六 阅读(51) 评论(0) 推荐(0)
摘要: 原生js实现检测对象变化。 通过把属性转换为访问器属性,实现监听。 对象属性的更改通过设置 get, set。 数组类型元素的更改通过在prototype重载操作数据的方法:slice、push、shift…… const OP = Object.prototype; const types = { 阅读全文
posted @ 2022-02-12 18:01 懒惰的星期六 阅读(6871) 评论(0) 推荐(0)
摘要: Context Context 提供了一个无需为每层组件手动添加 props,就能在组件树间进行数据传递的方法。 在一个典型的 React 应用中,数据是通过 props 属性自上而下(由父及子)进行传递的,但此种用法对于某些类型的属性而言是极其繁琐的(例如:地区偏好,UI 主题),这些属性是应用程 阅读全文
posted @ 2022-02-12 16:35 懒惰的星期六 阅读(103) 评论(0) 推荐(0)
摘要: 在高阶组件中转发 refs function logProps(WrappedComponent) { class LogProps extends React.Component { componentDidUpdate(prevProps) { console.log('old props:', 阅读全文
posted @ 2022-02-12 16:00 懒惰的星期六 阅读(93) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 29 下一页

Welcome to here

主页