会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
返回博主主页
懒惰的星期六
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
10
11
12
13
14
15
16
17
18
···
30
下一页
2022年2月14日
Promise.all即便有函数报错也不会中断其他函数的方法
摘要: 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 懒惰的星期六
阅读(415)
评论(0)
推荐(0)
2022年2月13日
typescript的type还可以这么定义函数?
摘要: 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 懒惰的星期六
阅读(87)
评论(0)
推荐(0)
redux(二、connect provider使用)
摘要: 笔记: 1. mapStateToProps中,使用state._time.xxx的原因是,_time是reducer函数的名字。 // 这是我们的 select 函数, 它会把我们需要在属性 (prop) 中对我们的组件暴露的数据从 state 中抽离出来 const mapStateToProp
阅读全文
posted @ 2022-02-13 14:01 懒惰的星期六
阅读(92)
评论(0)
推荐(0)
2022年2月12日
箭头函数的length属性
摘要: 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 懒惰的星期六
阅读(60)
评论(0)
推荐(0)
js监听数据的变化。
摘要: 原生js实现检测对象变化。 通过把属性转换为访问器属性,实现监听。 对象属性的更改通过设置 get, set。 数组类型元素的更改通过在prototype重载操作数据的方法:slice、push、shift…… const OP = Object.prototype; const types = {
阅读全文
posted @ 2022-02-12 18:01 懒惰的星期六
阅读(6899)
评论(0)
推荐(0)
React Context
摘要: Context Context 提供了一个无需为每层组件手动添加 props,就能在组件树间进行数据传递的方法。 在一个典型的 React 应用中,数据是通过 props 属性自上而下(由父及子)进行传递的,但此种用法对于某些类型的属性而言是极其繁琐的(例如:地区偏好,UI 主题),这些属性是应用程
阅读全文
posted @ 2022-02-12 16:35 懒惰的星期六
阅读(121)
评论(0)
推荐(0)
refs转发
摘要: 在高阶组件中转发 refs function logProps(WrappedComponent) { class LogProps extends React.Component { componentDidUpdate(prevProps) { console.log('old props:',
阅读全文
posted @ 2022-02-12 16:00 懒惰的星期六
阅读(121)
评论(0)
推荐(0)
函数组件与Refs
摘要: Refs 与函数组件 默认情况下,你不能在函数组件上使用 ref 属性,因为它们没有实例: function MyFunctionComponent() { return <input />; } class Parent extends React.Component { constructor(
阅读全文
posted @ 2022-02-12 15:37 懒惰的星期六
阅读(268)
评论(0)
推荐(0)
react状态提升
摘要: https://zh-hans.reactjs.org/docs/lifting-state-up.html 这样 多个子组件的值可以联动变化。 关键点: class ParentComponent extends React.Componnet{// ………… changeMyValue=(par
阅读全文
posted @ 2022-02-12 15:30 懒惰的星期六
阅读(70)
评论(0)
推荐(0)
React render prop
摘要: https://zh-hans.reactjs.org/docs/render-props.html 术语 “render prop” 是指一种在 React 组件之间使用一个值为函数的 prop 共享代码的简单技术 具有 render prop 的组件接受一个返回 React 元素的函数,并在组件
阅读全文
posted @ 2022-02-12 15:02 懒惰的星期六
阅读(73)
评论(0)
推荐(0)
上一页
1
···
10
11
12
13
14
15
16
17
18
···
30
下一页
公告