After discovering two working solutions, I am unsure which approach is more consistent.
interface ICatalogHome {
response: Result<CatalogHomePageResponse>;
}
export const getServerSideProps: GetServerSideProps<ICatalogHome> = async (context) => {
const appSlug = context.params?.appSlug;
const { locale } = context;
const response = await getCatalogHomePageData(appSlug as string, locale!);
const notFound = !response;
return {
props: {
response,
...(await serverSideTranslations(context.locale!, ['common', 'login']))
}, // will be passed to the page component as props
notFound
};
};
One Approach:
const CatalogHome: NextPage<InferGetServerSidePropsType<typeof getServerSideProps>> = ({ response }) => {...}
Another Approach:
const CatalogHome = ({ response }: InferGetServerSidePropsType<typeof getServerSideProps>) => {...}