-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ | |
setTimeout(()=>{ | ||
console.log('hello hoc!'); | ||
},1000) | ||
``` | ||
``` | ||
|
||
## array | ||
- some/every/forEach 都是 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# hoc-comp | ||
> High Order Component. | ||
|
||
## points | ||
- 输出一个组件,返回一个新的组件 | ||
- 是一个函数,并不是一个组件 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Proxy-hoc | ||
|
||
## feature | ||
- 操作 prop | ||
- 提取状态 | ||
- 访问 ref | ||
- 包装组件 | ||
|
||
## example | ||
```js | ||
export default () => WrappedComponent => class extends React.Component{ | ||
redner(){ | ||
const { ...props } = this.props; | ||
return <WrappedComponent {...props}/> | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# extend hoc | ||
|
||
|
||
## feature | ||
- 操作 prop | ||
- 操作 生命周期函数 | ||
|
||
## example | ||
```js | ||
export default () => WrappedComponent => class extends WrappedComponent{ | ||
redner(){ | ||
const { user,...props } = this.props; | ||
// 这里可以直接 = ? | ||
this.props = props; | ||
return super.render(); | ||
} | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ | |
## why | ||
- 高阶组件很重要 | ||
- 关于这块的资料比较少 | ||
- 关于这块的资料比较少 | ||
|
||
## conclution | ||
- 一般,不用再看第2次了 |