When I load the hits widget
for InstantSearch.js v4 it successfully loads all data.
However, I want to only load a specific query and it doesn’t change the data at all.
Any ideas?
const search = instantsearch({
indexName: 'Products',
searchClient: algoliasearch(
'APPID',
'SECRET'
),
initialUiState: {
Products: {
query: 'spoon',
page: 1,
},
},
});
search.addWidgets([
instantsearch.widgets.hits({
container: "#hits",
templates: {
empty: "No results.",
escapeHTML: false,
item(hit){
return `
<div class="hit">
<div class="hit-image">
<img src="${hit.image}" />
</div>
<div class="hit-content">
<div>
<div class="hit-name">${hit.name}</div>
</div>
<div class="hit-price">$${hit.price}</div>
</div>
</div>
`;
}
}
})
})