can someone explain to me (as if I was 5) why it is possible to do codegen for NextJS with pages
but not for apps
?
apps
uses a special run time for react server components, and components there need to be cognizant of whether they can be used on the server or the client. Plasmic components right now make use of React contexts and so mostly need to be rendered as client components. Even so, the usual strategy for extracting the data queried by your design for SSR does not work; the technique attempts to pre-render your page and fire off any data fetching that will be done, so it can cache the fetched data. But in the react-server-component runtime, not all components can be pre-rendered, as it only supports importing server components and not client components
hi, checking back in how close it is to do codegen for NextJS App Router
You can use codegen components in Next.js app router for quite a while now, with the caveat that pre-fetching data is not supported. This is documented here: Get started with Next.js | Learn Plasmic
We have an experimental version of pre-fetching data available too, which I believe you’re in the Slack channel for.