I'm got a React application where I'm using JSX and I have a condition that is: if an input is selected (i.e. is true) pass a particular query through to a search engine. I also want to add background styling to the same condition so I came up with the following:
<div style={ui.selected.thisInput && {background: "red"} }></div>
I also tried:
<div style={{ ui.selected.thisInput ? "background:red" }}></div>
Both of which throw errors.