Having a very strange issue with a Plasmic component being loaded into _app as a layout component. The component is being rendered in Plasmic studio UI
import { PlasmicComponent, PlasmicRootProvider } from '@plasmicapp/loader-nextjs';
import { PLASMIC } from '../plasmic-init';
import '../styles/global.css';
function MyApp({ Component, pageProps }: any) {
return (
<PlasmicRootProvider loader={PLASMIC} >
<PlasmicComponent component="Header" />
<div>
<Component {...pageProps} />
</div>
<footer></footer>
</PlasmicRootProvider>
);
}
export default MyApp;
You’ll need to exempt rendering the layout component for the /plasmic-host
page. You can do it a few different ways; I think this would work:
// plasmic-host.tsx
export default function PlasmicHost() {
}
PlasmicHost.isPlasmicHost = true;
// _app.ts
function MyApp({Component, pageProps}) {
if (Component.isPlasmicHost) {
return <Component {...pageProps} />;
} else {
// ...
}
}
Thanks this works Is possible to target more specific?
Could we show the header component in Plasmic host, but only in the page views?
Hmm no not really… And we don’t really support having the host page render anything but PlasmicCanvasHost at the moment; weird things may happen
haha well until you support plugins