SSR
const url = `/collections/all?category=%5B"Shorts"%5D&colour=%5B"atlantic"%5D`;
const query = {
category: "[\"Shorts\"]",
colour: "[\"atlantic\"]",
};NextJs
import React from "react";
import { ReactifySearchProvider, generateProviderProps } from "@usereactify/search";
// "props" is the return value from Main.getInitialProps
const Main = (props) => {
return (
<ReactifySearchProvider
{...props}
>
...
</ReactifySearchProvider>
);
};
// Runs on the server, returns the props provided and generates the special "preload" prop
Main.getInitialProps = async (context) => {
const serverProps = await generateProviderProps({
mode: "collection",
collectionHandle: "shirts",
shopifyPermanentDomain: "usereactify-demo-big.myshopify.com",
query: context.query,
});
return serverProps;
};
export default Main;
Last updated