I have a very simple component, which should be styled differently based on the passed condition.
I wonder if there is a better approach to refactor this piece of code?
function RandomComponent({ number, condition }) {
let classNameToUse;
switch (condition) {
case 'high':
classNameToUse = 'number number--high';
break;
case 'medium':
classNameToUse = 'number number--medium';
break;
default:
classNameToUse = 'number';
}
return <div className={classNameToUse}>{number}</div>;
}