Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The implementation depends on what style tools you use. The principle itself will be the same:
const getColor = value => {
switch(value) {
case 20:
return 'orange';
case 50:
return 'blue';
}
}
render() {
const { value } = this.props;
return <ExampleComponent style={{ color: getColor(value) }} />;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question