The following example shows how the <ReactRuntimeProvider> is used to implement the <MakeswiftProvider> client component as outlined in step 9 of the App Router Installation guide. The <MakeswiftProvider> is subsequently utilized in the App Router’s root layout.
The following example shows how to add a <ReactRuntimeProvider> to a Custom App as outlined in step 10 of the Pages Router Installation guide. The previewMode property is returned from getStaticProps in an optional catch-all route.
Copy
Ask AI
import type { AppProps } from "next/app";import { ReactRuntimeProvider } from "@makeswift/runtime/next";import { runtime } from "@/makeswift/runtime";import "@/makeswift/components";export default function App({ Component, pageProps: { previewMode, locale, ...pageProps },}: AppProps) { return ( <ReactRuntimeProvider runtime={runtime} previewMode={previewMode} locale={locale} > <Component {...pageProps} /> </ReactRuntimeProvider> );}