We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
高阶组件类似于函数式编程中的高阶函数,指的是向函数中传递一个react组件,函数将返回一个新的react组件。使用高阶组件我们可以很轻松地对原有组件进行进一步的抽象并同时保持原有组件的稳定性。
高阶组件的特性体现在两个地方:
import React, { Component } from 'react'; const EnchanceComFactory = (wrappedComponent) => { return class extends Component { const newProps = { text: 'just do it' }; render() { // React.createElement(WrappedComponent, this.props, null) return <wrappedComponent {...this.props} {...newProps}/> } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
前言
高阶组件类似于函数式编程中的高阶函数,指的是向函数中传递一个react组件,函数将返回一个新的react组件。使用高阶组件我们可以很轻松地对原有组件进行进一步的抽象并同时保持原有组件的稳定性。
高阶组件的特性体现在两个地方:
属性代理
The text was updated successfully, but these errors were encountered: