Conditional if to change style

How do I complete a conditional if statement to change the colour of an attribute (fin_txt_yn) dependent on the word?

For example in the Algolia database I have either the word green or the word red which I would like to make green and red respectively dependent on which word is in the data. I am using React Instant search. Code as follows: -

   function Hit ({hit}) {
      return (<div classname="hit">
      <div className="testresult"> {hit.fin_txt_yn}</div>

render as per react instant search.

Hi @gilesgerman, the way to do so is not linked or tied to Algolia, your question is about “How to dynamically change some JSX based on a prop”, to do so I advise you to read more about how JSX works:

And then ask your question on Stack Overflow itself about this need: