I am trying to combine Radium and Material-ui. When I try to apply multiple styles on a single Material-ui component, no style is applied. So, for example, something like this produces no styling applied:
<MenuItem style={[styles.styleOne, styles.styleTwo]} >
Of course, if I do something like:
<MenuItem style={Object.assign({}, styles.styleOne, styles.styleTwo)} >
it works. Is there some way around it or this is the only way to use Radium for combining styles for a Material-ui component? And just to mention, Radium is properly set up, because applying array of styles on, for example, DIV element or works properly. Also, I am open to any suggestion about styling a React project that uses Material-ui library. Thanks!
Check out this fiddle: https://jsfiddle.net/Lxh5x2qr/
It uses the JSX spread (
...) operator, which is a bit nicer syntax:Please notice the the order of object does matter, just like in
Object.assign.We should not forget that
MenuItemis not a DOM element, so when we applystyleto it,material-uimanipulates it before applying it to the underlying element, and probably this is the reason why using an array does not work.