[英]How to use 2 higher-order components at the same time? (in order to use injectIntl from react-intl)
我知道,为了使用react-intl库中的injectIntl,我将需要以下内容:
export default injectIntl(SectionNavbars)
但是我已经在使用withStyles高阶组件,如何将两者结合起来?
import React from 'react'
/* more stuff */
import { injectIntl } from 'react-intl'
class SectionNavbars extends React.Component {
render() {
const { classes } = this.props;
const { intl } = this.props;
return (
<div className={classes.section}>
<Header
brand={ <img src={logo}/> }
rightLinks={
<ListItem className={classes.listItem}>
<CustomDropdown
buttonText={intl.formatMessage({ id: 'products' })}
buttonProps={{
className: classes.navLink,
}}
dropdownList={[
/*stuff*/
]}
/>
</ListItem>
}
/>
</div>
);
}
}
export default withStyles(navbarsStyle)(SectionNavbars);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.