[英]ReactJS dont take the css styles
技术:
去做 :
尝试案例:
onClick={this.handleClick} style={this.state.currentPage === number ?
styles.paginationButtons : [styles.paginationButtons,
{backgroundColor:'blue'}]}>
尝试更新代码,以便在不使用数组的情况下为组件提供动态样式。
您应该可以通过以下方式进行操作:
style={ (this.state.currentPage === number ? styles.paginationButtons : { backgroundColor:'blue', ...styles.paginationButtons }) }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.