blog: 更新React hook笔记

This commit is contained in:
xugaoyi 2021-04-06 19:14:18 +08:00
parent 7a662a9288
commit 57dccdeb6f
4 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,13 @@
---
title: 使用State Hook
date: 2021-04-06 19:13:06
permalink: /pages/82baa3/
categories:
- 《React》笔记
- Hook
tags:
-
---
# 02. 使用State Hook
```jsx

View File

@ -1,3 +1,13 @@
---
title: 使用Effect Hook
date: 2021-04-06 19:13:06
permalink: /pages/72710d/
categories:
- 《React》笔记
- Hook
tags:
-
---
# 03. 使用Effect Hook副作用钩子
如果你熟悉 React class 的生命周期函数,你可以把 `useEffect` Hook 看做 `componentDidMount`(挂载完成)`componentDidUpdate`(更新完成) 和 `componentWillUnmount`(即将销毁前) 这三个函数的组合。

View File

@ -1,3 +1,13 @@
---
title: Hook规则
date: 2021-04-06 19:13:06
permalink: /pages/723be7/
categories:
- 《React》笔记
- Hook
tags:
-
---
# 04. Hook规则
Hook 本质就是 JavaScript 函数,但是在使用它时需要遵循**两条规则**。我们提供了一个 [linter 插件](https://www.npmjs.com/package/eslint-plugin-react-hooks)来强制执行这些规则:

View File

@ -1,3 +1,13 @@
---
title: 自定义 Hook
date: 2021-04-06 19:13:06
permalink: /pages/cf1018/
categories:
- 《React》笔记
- Hook
tags:
-
---
# 05. 自定义 Hook
**通过自定义 Hook可以将组件逻辑提取到可重用的函数中。**