react className 样式控制
1.<div className={ "formbox " + this.state.classArr }></div>
2. this.state.classArr = [];
<div className={ "formbox " + this.state.classArr.jion(" ") }> </div>
this.state.classArr.pop()
this.state.classArr.push(".demo") 可以更改class 页面也会出发更新
Like (){
this.setState({
isLike:!this.state.isLike
});
console.log(11);
}
<span className="like" onClick={ this.Like }><span className={ this.state.isLike ? 'active iconfont' : 'iconfont' } ></span>喜欢</span>