i am getting the color based on the variable books and pens. if books or pens value is 0 apply red, value is 1 apply blue else green.
From code below the code is redunant meaning i am applying same colors based on value. how can i refactor it such that it can be be simplified further.
Below is the code,
const booksCountColor =
books === 0
? red
: books === 1
? blue
: green;
const pensCountColor =
pens === 0
? red
: pens === 1
? blue
: green;
Could someone help me with this. thanks.