-
Notifications
You must be signed in to change notification settings - Fork 8
/
plasmic-init-client.tsx
24 lines (20 loc) · 1.12 KB
/
plasmic-init-client.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use client";
import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
import { PLASMIC } from "./plasmic-init";
// You can register any code components that you want to use here; see
// https://docs.plasmic.app/learn/code-components-ref/
// And configure your Plasmic project to use the host url pointing at
// the /plasmic-host page of your nextjs app (for example,
// http://localhost:3000/plasmic-host). See
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
// PLASMIC.registerComponent(...);
/**
* PlasmicClientRootProvider is a Client Component that passes in the loader for you.
*
* Why? Props passed from Server to Client Components must be serializable.
* https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
* However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
*/
export function PlasmicClientRootProvider(props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">) {
return <PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>;
}