0.14.0
ReactRuntimeProvider
runtime
import { runtime } from "@/makeswift/runtime" import { ReactRuntimeProvider } from "@makeswift/runtime/next" import type { AppProps } from "next/app" export default function App({ Component, pageProps }: AppProps) { return ( <ReactRuntimeProvider runtime={runtime}> <Component {...pageProps} /> </ReactRuntimeProvider> ) }
Page
import { Page as MakeswiftPage } from '@makeswift/runtime/next' import { runtime } from '@/makeswift/runtime' /* ... */ export default function Page({ snapshot }: Props) { - return <MakeswiftPage snapshot={snapshot} runtime={runtime} /> + return <MakeswiftPage snapshot={snapshot} /> }
React.lazy
next/dynamic
import { runtime } from '@/makeswift/runtime' - import dynamic from 'next/dynamic' - import { forwardNextDynamicRef } from '@makeswift/runtime/next' + import { lazy } from 'react' runtime.registerComponent( - forwardNextDynamicRef(patch => - dynamic(() => patch(import('./Button').then(({ Button }) => Button))) - ) + lazy(() => import('./Button')), { type: 'Button', label: 'Button', props: {} } )
Was this page helpful?