Skip to content

Commit

Permalink
Merge pull request ascoders#52 from mopetite/patch-2
Browse files Browse the repository at this point in the history
Update 12.精读 React 高阶组件.md
  • Loading branch information
ascoders authored Dec 24, 2017
2 parents 3ad2d3d + 3a43303 commit 4f9815a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 12.精读 React 高阶组件.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ Form 中会包含各种不同的组件,常见的有 Input、Selector、Checkbo

![image](https://user-images.githubusercontent.com/9314735/27116337-3f1f16a8-5103-11e7-8dc6-c7197e1b1eab.png)

至于 HOC 在 Form 上的具体实现,首先将表单中的组件(Input、Selector...)与相应 validator 与组件值回调函数名(trigger)传入 Decorator,将 validator 与 trigger 相绑定。Decorator 完成了各种不同组件与 From 内置 Store 间 value 的传递、校验功能的抽象,即精读文章中提到 Props Proxy 方式的其中两种作用:**提取state****操作props**
至于 HOC 在 Form 上的具体实现,首先将表单中的组件(Input、Selector...)与相应 validator 与组件值回调函数名(trigger)传入 Decorator,将 validator 与 trigger 相绑定。Decorator 完成了各种不同组件与 Form 内置 Store 间 value 的传递、校验功能的抽象,即精读文章中提到 Props Proxy 方式的其中两种作用:**提取state****操作props**

```javascript
function formFactoryFactory({
validator,
trigger = 'onChange',
...
}) {
return FromFactory(WrappedComponent) {
return FormFactory(WrappedComponent) {
return class Decorator extends React.Component {
getBind(trigger, validator) {
...
Expand Down

0 comments on commit 4f9815a

Please sign in to comment.