This works:
{hits.map(item => (
<ul>
{item.tags.map((value, index) => (
<li key={value}>{value}</li>
))}
</ul>
))}
But when I try to highlight:
{hits.map(item => (
<ul>
{item.tags.map((value, index) => (
<li key={value}><Highlight hit={item} attribute={item.tags[index]} /></li>
))}
</ul>
))}
Doesn't work. Am I doing this wrong?
The attribute is a string, not a value, so this would be more like the following:
https://codesandbox.io/s/react-instantsearch-app-e5v38
{item.tags.map((_cat, i) => (
<li key={i}><Highlight attribute={`tags[${i}]`} hit={item} /></li>
))}
Hope that helps!
@Haroenv Thanks!
Most helpful comment
The
attributeis a string, not a value, so this would be more like the following:https://codesandbox.io/s/react-instantsearch-app-e5v38
Hope that helps!