我正在尝试将Radium和Material-ui结合起来.当我尝试在单个Material-ui组件上应用多个样式时,不应用任何样式.因此,例如,类似这样的东西不会产生样式:
<MenuItem style={[styles.styleOne, styles.styleTwo]} >
Run Code Online (Sandbox Code Playgroud)
当然,如果我这样做:
<MenuItem style={Object.assign({}, styles.styleOne, styles.styleTwo)} >
Run Code Online (Sandbox Code Playgroud)
有用.有没有办法绕过它或者这是使用Radium组合Material-ui组件样式的唯一方法?而且,只需提及,Radium已正确设置,因为在例如DIV元素上应用样式数组或正常工作.此外,我对任何有关使用Material-ui库的React项目样式的建议持开放态度.谢谢!
我正在使用 Radium 库在 React 中进行内联样式。使用它对于其他组件效果很好,但我在使用 Material-UI 组件时遇到问题。当我将鼠标悬停在纸张上时,它不会将颜色更改为绿色。这是怎么回事?我该如何解决 ?
import React, { Component, Fragment } from 'react';
import { Grid, GridList, Paper, ListItem, List, ListItemIcon, ListItemText } from '@material-ui/core';
import { connect } from 'react-redux';
import Radium from 'radium';
class AchievementsHome extends Component {
render() {
return <>
<Grid container alignItems="center" direction="column">
<h1>Achievements</h1>
<Paper
style={{backgroundColor:'red' , ':hover':{backgroundColor:'green' }}
>
<h1>Hi</h1>
</Paper>
</Grid>
</>
}
}
const mapStateToProps = (state) => {
return {
achievements: state.achievements
}
}
export default connect(mapStateToProps)(Radium(AchievementsHome));
Run Code Online (Sandbox Code Playgroud) radium ×3
reactjs ×3
material-ui ×2
css ×1
ios ×1
javascript ×1
react-native ×1
react-redux ×1