In my React app I have a box which is styled. The component holds state. I would like to change the colour of the box dependant on the colour.
For example, if selectedID = 1, pink, if selectedID = 2, green etc and so on.
I've tried something like this with no success:
<InformationContainer
// style={ {backgroundColor: selectedID < 2 || selectedID > 2 ? '#ebedfb':'#ffe5e5'}}
style={ {backgroundColor:
selectedID < 4 ? '#ffe5e5':
selectedID < 3 || selectedID > 2 ? '#414c97':
selectedID < 3 || selectedID > 3 ? '#65bb2c':
selectedID < 3 || selectedID > 3 ? 'yellow':
'white'
}}
>
I would like o have this for all 4 boxes and pieces of state.
selectedID?