'Checking a variable in React and using to show an element

I have a redux piece of state that is selected. This will return an array of selections, e.g 3 words or what not.

With this, I want to continually check this variable and show and NOT element if the list is GREATER then 1, eg only show when filtered to 1 selection.

See below code:

const [activeRole, setActiveRole] = useState(false)
const searchResults = useSelector(state => state.jobsearch.roles.map(role => role.title))

  const handleActiveSelection = () => {
    if (searchResults.length > 1) {
      setActiveRole(true)
    }
  }

Would I need to use a useEffect to continually monitor this? How would I embed a clause into my element?

E.g: ONLY show when 1 selection?

          {finalSelection &&  (
            <MessageContainer>
              <Typography>
                You have selected {searchResults}
              </Typography>
            </MessageContainer>
          )}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source