Hi everybody this is my code and I'm trying that the page render an alternative text if I type in the search bar and the API doesn't found the text that I'm looking for enter image description here I tried in that way putting a alternativeText variable and then putting a conditional with the Search function but the text it's not shown.enter image description here
As per your code in the image, there is a mistake in the condition checking. You are checking with the component name, which will always returns true.
Your actual condition should be,
const showSearch = (searchResult?.length > 0) ? resultHtml : alternativeText;