Skip to content

Commit

Permalink
add: hoc-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Aug 14, 2019
1 parent ed93d2b commit fe69fec
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/imooic-hoc/001-what-is.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
setTimeout(()=>{
console.log('hello hoc!');
},1000)
```
```

## array
- some/every/forEach 都是
8 changes: 8 additions & 0 deletions docs/imooic-hoc/002-hoc-comp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# hoc-comp
> High Order Component.

## points
- 输出一个组件,返回一个新的组件
- 是一个函数,并不是一个组件

18 changes: 18 additions & 0 deletions docs/imooic-hoc/003-proxy-hoc.md
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}/>
}
}
```

19 changes: 19 additions & 0 deletions docs/imooic-hoc/004-extend-hoc.md
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();
}
}
```

5 changes: 4 additions & 1 deletion docs/imooic-hoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
## why
- 高阶组件很重要
- 关于这块的资料比较少
- 关于这块的资料比较少

## conclution
- 一般,不用再看第2次了

0 comments on commit fe69fec

Please sign in to comment.