I am trying to filter out some results returned by Algolia and am trying out the useQueryRules hook. I created a QueryRuleContext component as follows:
import { useQueryRules } from 'react-instantsearch-hooks-web';
const transformItems = (items, { results }) => {
console.log(items, results);
return items;
};
const QueryRuleContext = (props) => {
const { items } = useQueryRules({
transformItems
});
return null;
};
export default QueryRuleContext;
I’m then using it directly within my InstantSearch component as <QueryRuleContext />
. The results object is populated with all of the hits and other information as expected, but the items array is empty. What am I missing? Am I using the hook incorrectly? What’s the difference between items
and results.hits
?