material-ui里面的withStyles是什么?

export default withStyles(styles, { name: 'MuiAppBar' })(AppBar);
//这里的作用是什么?
withStyles 是一个 HOC 组件,会为你的 AppBar 组件根据当前的 theme 来添加样式。核心功能就是为子组件提供了一个 classes props,这样你就可以在外部对 class name 进行修改。
在你这个例子中,就会将第一个参数 styles 的样式,覆盖掉原来主题中的 MuiAppBar 样式。
有此疑问,本文看自:https://segmentfault.com/q/1010000012687223/a-1020000012695709

原文地址:https://www.cnblogs.com/smart-girl/p/10796653.html