2021年3月9日
摘要: 恢复内容开始 1、var 和 let 声明变量有什么区别: 1)作用于不同:let 是在代码块内有效,var 是在全局范围内有效 2)var具有变量声明提升,let没有变量声明提升 3)var 可以在同一作用域重复声明变量,let不可以 4)let 声明的变量具有暂时性死区,var没有 (ES6 明 阅读全文
posted @ 2021-03-09 11:24 zhengyulu 阅读(46) 评论(0) 推荐(0) 编辑
  2020年5月29日
摘要: 1、es6 数组的push方法 let oldArr = [1,2,3] let newArr = [...oldArr,4] 2、卸载函数,直接在useEffect函数中return函数即可 3、 自定义Hook,抽取公用Hook 4、HOC:Higher Order Componnet 高阶组件 阅读全文
posted @ 2020-05-29 23:36 zhengyulu 阅读(126) 评论(0) 推荐(0) 编辑
  2020年5月17日
摘要: 参考文档:http://www.ruanyifeng.com/blog/2019/09/react-hooks.html react在线编辑器:https://codesandbox.io/s/funny-forest-ncv8b 1、useState import React, { useStat 阅读全文
posted @ 2020-05-17 18:05 zhengyulu 阅读(172) 评论(0) 推荐(0) 编辑
  2020年5月13日
摘要: 1、React.PureComponent 与 React.Component 完全相同,但是在shouldComponentUpdate()中实现时,使用了 props 和 state 的浅比较。 注意: React.PureComponent 的 shouldComponentUpdate()  阅读全文
posted @ 2020-05-13 16:46 zhengyulu 阅读(115) 评论(0) 推荐(0) 编辑
  2020年5月12日
摘要: 1、ref的3种使用方式 1)字符串的方式 2)回调函数(推荐) 3)React.createRef() (react16.3新提供的方式) 1、字符串的方式 class DOM extends React.Component{ constructor(props){ super(props); t 阅读全文
posted @ 2020-05-12 22:12 zhengyulu 阅读(84) 评论(0) 推荐(0) 编辑
  2020年5月8日
摘要: 1、jsx = js+xml 是js的拓展语法 从本质上讲,JSX 只是为 React.createElement(component, props, ...children) 函数提供的语法糖 优点:1)执行的效率更快 2)他是类型安全的,编译的过程中就行及时的发现错误 3)在使用jsx的时候编写 阅读全文
posted @ 2020-05-08 18:51 zhengyulu 阅读(125) 评论(0) 推荐(0) 编辑
  2020年4月7日
摘要: 1、refs/for/branch 提交后进入changes中等待code review 2.close更改 3.项目右键选择Git同步选项,对讲推送的提交进行重置版本,这样就会是重置的版本上保留现有改动 阅读全文
posted @ 2020-04-07 18:15 zhengyulu 阅读(496) 评论(0) 推荐(0) 编辑
  2020年3月27日
摘要: 1.路由 content = <Switch> <Route path="/login" exact component={LoginPage} /> <Route render={() => { return <Redirect to="/login" />; }} /> </Switch> // 阅读全文
posted @ 2020-03-27 16:27 zhengyulu 阅读(116) 评论(0) 推荐(0) 编辑
  2020年3月22日
摘要: 1.获得一个网站的ip地址的方法是:ping www.xxx.com2.如何查看本机的ip地址:用ipconfig来查看就可以!3.刷新DNS缓存:ipconfig /flushdns 阅读全文
posted @ 2020-03-22 20:29 zhengyulu 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 应用情景 经典使用情景:js的一些事件,比如:onresize、scroll、mousemove、mousehover等; 还比如:手抖、手误、服务器没有响应之前的重复点击; 这些都是没有意义的,重复的无效的操作,设置对整个系统的影响还可能是致命的,所以我们要对重复点击的事件进行相应的处理! 节流函 阅读全文
posted @ 2020-03-22 16:48 zhengyulu 阅读(3212) 评论(0) 推荐(0) 编辑