会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
brave-sailor
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
5
6
7
8
9
···
353
下一页
2021年11月28日
React事件绑定的几种方式对比
摘要: React事件绑定 由于类的方法默认不会绑定this,因此在调用的时候如果忘记绑定,this的值将会是undefined。通常如果不是直接调用,应该为方法绑定this。绑定方式有以下几种: 1. 在构造函数中使用bind绑定this class Button extends React.Compon
阅读全文
posted @ 2021-11-28 17:10 brave-sailor
阅读(67)
评论(0)
推荐(0)
2021年11月26日
React 函数组件
摘要: 如何创建函数组件 箭头函数形式 const Hello = (props) => { return <div>{props.message}</div> } // 可以简写成 const Hello = props => <div>{props.message}</div> function 形式
阅读全文
posted @ 2021-11-26 17:46 brave-sailor
阅读(130)
评论(0)
推荐(0)
2021年11月25日
React创建组件的三种方式
摘要: 使用函数式创建 import {render} from 'react-dom'; function Hello(props){ return (<div>{props.name}</div>) } render(<Hello name='yf' />,document.getElementById
阅读全文
posted @ 2021-11-25 18:19 brave-sailor
阅读(209)
评论(0)
推荐(0)
2021年11月24日
React学习笔记 - useState解析
摘要: 引入 对于函数组件 const App = props => { const [n, setN] = useState(0) //... } 在setN执行后: n不会被setN改变(重要!) 会触发UI更新,App()再次执行,再次useState(0)时,得到n的值不同 分析: setN将n的新
阅读全文
posted @ 2021-11-24 11:50 brave-sailor
阅读(623)
评论(0)
推荐(0)
全面掌握 React — useReducer
摘要: 在 hooks 中提供了的 useReducer 功能,可以增强 ReducerDemo 函数提供类似 Redux 的功能,引入 useReducer 后,useReducer 接受一个 reducer 函数作为参数,reducer 接受两个参数一个是 state 另一个是 action 。然后返回
阅读全文
posted @ 2021-11-24 11:40 brave-sailor
阅读(180)
评论(0)
推荐(0)
React-Hooks中的useReducer
摘要: 用来践行Flux/Redux的思想 一共分为四步: 创建初始值initialState const initial = { n:0 } 创建所有操作reducer(state,action) const reducer = (state ,action)=>{ if(action.type 'add
阅读全文
posted @ 2021-11-24 11:25 brave-sailor
阅读(50)
评论(0)
推荐(0)
2021年11月22日
React中useEffect使用
摘要: 之前我们已经掌握了useState的使用,在 class 中,我们通过在构造函数中设置 this.state 为 { count: 0 } 来初始化 count state 为 0: class Example extends React.Component { constructor(props)
阅读全文
posted @ 2021-11-22 18:06 brave-sailor
阅读(226)
评论(0)
推荐(0)
React 之export和export default
摘要: 一、 ES6的模块化的基本规则或特点 每一个模块只加载一次, 每一个JS只执行一次, 如果下次再去加载同目录下同文件,直接从内存中读取。 一个模块就是一个单例,或者说就是一个对象; 每一个模块内声明的变量都是局部变量, 不会污染全局作用域 模块内部的变量或者函数可以通过export导出 一个模块可以
阅读全文
posted @ 2021-11-22 18:05 brave-sailor
阅读(978)
评论(0)
推荐(0)
2021年11月15日
this exceeds GitHub's file size limit of 100 MB
摘要: GitHub对文件的大小有限制,问题在于,当移除了相关的文件之后,问题依然存在。 解决方法: 除了移除相关的文件,还要修改git的历史记录,移除相应的commit结点。 最简单的方法是使用以下命令: git filter-branch -f --index-filter 'git rm --cach
阅读全文
posted @ 2021-11-15 18:06 brave-sailor
阅读(161)
评论(0)
推荐(0)
2021年11月14日
iOS 使用 symbolicatecrash解析crash log
摘要: https://www.jianshu.com/p/4de55d73c82b
阅读全文
posted @ 2021-11-14 20:36 brave-sailor
阅读(33)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
···
353
下一页
公告