sdk-react
sdk-react copied to clipboard
Pagination without safari component
I using sajari for my demo app.
-
I have 1 list and I want to show more items, I don't want to use the sajari component but I can't query after I change variables page.
-
I using useSearchContext to get page and results, I cover my component with component search provider, code example bellow:
<SearchProvider key="{index}" searchOnLoad={false} initialResponse="" search={{ pipeline: new Pipeline( { ...getConfigPipeline("") }, "query" ), variables: new Variables({ q: "", filter: "", resultsPerPage: 6, }), }} > <MyComponent/> </SearchProvider>
-
Render result
const { setQuery } = useQuery(); const { variables } = useVariables(); const { results, searching, totalResults, page, pageCount, } = useSearchContext();
-
And then I use variables hook(useVariables) to set request for other page but It not request, code example bellow:
const OtherComponent = ({ setQuery, textSearch, variables }) => { const handleShowMore = () => { variables.set({ page: page + 1, }); };
So how can set pagination without component your support?
- [ ] I only try for used useSearch but not good for my case.