I am trying to change the color of list elements in my conditional rendering in react.js.
onClick={exist ? () => {this.handleClick(); this.props.updateSummary(store_id)} : null }
I want to have style="color :#E8E8E8"
and not :null. It seems like I can not use inline styling in onClick function while doing conditional rendering. Any ideas how to do it? Thank you
<ul>
{this.props.stores.map(({exist, store_id}) => (
<li className ="storeIdList" onClick={exist ? () => {this.handleClick(); this.props.updateSummary(store_id)} : null }>Store Id: {store_id}</li>
))}
</ul>
Aucun commentaire:
Enregistrer un commentaire