Hello, I am looking to modify my CSS condition in JSX. Here is the current condition:
style={{
background:
(input.categoryName[0] === "A" ? "#FF6F33" : null) ||
(input.categoryName[0] === "B" ? "#2C828f" : null) ||
(input.categoryName[0] === "C" ? "#C048EE" : null) ||
(input.categoryName[0] === "E" ? "#01D584" : null) ||
(input.categoryName[0] === "F" ? "#FF47BE" : null) ||
(input.categoryName[0] === "G" ? "#F96693" : null) ||
(input.categoryName[0] === "H" ? "#549EF0" : null) ||
(input.categoryName[0] === "I" ? "#FEA544" : null),
}}
I want it to look something like this instead:
(input.categoryName[0] === "A" ? "#FF6F33" :
=== "B" ? "#2C828f" :
=== "C" ? "#C048EE" :
=== "E" ? "#01D584" :
=== "F" ? "#FF47BE" :
=== "G" ? "#F96693" :
=== "H" ? "#549EF0" :
=== "I" ? "#FEA544" : null),
Any suggestions?