Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOC #102

Open
Lawguancong opened this issue Oct 12, 2021 · 0 comments
Open

HOC #102

Lawguancong opened this issue Oct 12, 2021 · 0 comments

Comments

@Lawguancong
Copy link
Owner

Lawguancong commented Oct 12, 2021

hocFactory:: W: React.Component => E: React.Component
W (WrappedComponent) 是被包裹的 React.Component;而函数返回的 E (Enhanced Component) 则是新得到的 HOC,也是个 React.Component。

  • 高阶组件就是包裹了其他 React Component 的组件
  • 是一个组件工厂
  • 代码重用和逻辑抽象
  • render 劫持
  • state 抽象和操纵
  • 操纵属性(props)

参考链接
https://juejin.cn/book/6945998773818490884/section/6957722790673776671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant