withStyles()
is a higher order component, which injects styles
props.
const cssMap = {
main: {
border: '1px solid red'
}
};
const MyComp = withStyles(cssMap, ({styles}) => {
return <div className={styles.main} />
});
You can specify the name our your component as a third argument.
withStyles(cssMap, MyComp, 'MyComponent');
Or you can name your function, in that case the function name will be automatically picked up.
const MyComp = withStyles(cssMap, function MyComponent ({styles}) {
return <div className={styles.main} />
});
Install withStyles
addon and its dependencies:
Read more about the Addon Installation.