getStaticPropsWithSdk#
A wrapper function that injects a client from getClient, typed by codegen, into Next.js getStaticProps.
It supports Next.js's Preview mode, by making sure to query the correct version (draft or published) of the content.
This function requires that GraphQL Code Generator is already set up, refer to getClients example for more information.
Parameters#
getStaticPropsWithSdk expects a client from getClient, getSdk from graphql-codegen, and a Storyblok preview API token to be provided. It returns a function that can be wrapper around getStaticProps.
Usage#
Basic example#
For a full configuration, please see the example.
For more information on this configuration of GraphQL Code Generator and its options, check out the docs.