-
As of now, server-rendered components are not supported.
There seems to be a fix by using Here's a minimal sample that will throw the error: import { Heading } from "@twilio-paste/core/heading";
import { Breadcrumb, BreadcrumbItem } from "@twilio-paste/core/breadcrumb";
import { Theme } from "@twilio-paste/core/theme";
export default function Home() {
return (
<Theme.Provider theme="default">
<Heading as="h1" variant="heading10">
Welcome to the the Paste Next.JS App!
</Heading>
<Breadcrumb>
<BreadcrumbItem href="#">Phone Numbers</BreadcrumbItem>
<BreadcrumbItem href="#">Active Numbers</BreadcrumbItem>
</Breadcrumb>
</Theme.Provider>
)
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary. Sorry, I don't know how to help with that. I did do a search though, and I managed to find these other Discussions that might be similar or related to your question. Give them a read to see if they answer your question. If they do, head back here and update this discussion and mark it as answered, pointing others to the related discussion:
|
Beta Was this translation helpful? Give feedback.
-
🤖 Hello @IObert! 👋 I'm Dosu, a friendly bot here to assist you in the meantime while we wait for a human maintainer. I'm here to help you solve bugs, answer your questions, and guide you in becoming a contributor. Looking forward to working with you! Based on the current information available in the Paste repository, the Paste design system (@twilio-paste/[email protected]) does support Next.js 13. However, the issue you're encountering seems to be related to the use of server-side components in Next.js 13, which is a relatively new feature. The error message you're seeing suggests that the Unfortunately, the Paste design system does not currently use In the meantime, you might be able to work around this issue by ensuring that the Here's an example of how you might modify your import { useState, useEffect } from 'react';
import { Heading } from "@twilio-paste/core/heading";
import { Breadcrumb, BreadcrumbItem } from "@twilio-paste/core/breadcrumb";
import { Theme } from "@twilio-paste/core/theme";
export default function Home() {
const [isClient, setIsClient] = useState(false);
useEffect(() => {
setIsClient(true);
}, []);
if (!isClient) {
return null;
}
return (
<Theme.Provider theme="default">
<Heading as="h1" variant="heading10">
Welcome to the the Paste Next.JS App!
</Heading>
<Breadcrumb>
<BreadcrumbItem href="#">Phone Numbers</BreadcrumbItem>
<BreadcrumbItem href="#">Active Numbers</BreadcrumbItem>
</Breadcrumb>
</Theme.Provider>
);
} This code uses the Please note that this is just a workaround and may not be suitable for all use cases. It would be best if the Paste design system could be updated to support server-side components in Next.js 13 directly. However, I'm unable to create pull requests or issues, so I would recommend reaching out to the maintainers of the Paste repository directly to discuss this issue further. I hope this helps! If you have any further questions, please don't hesitate to ask. -Dosu SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Hi @IObert We're somewhat at the mercy of Emotion CSS right now, and Material UI is in the same boat as us, FWIW. There seems to be a couple threads;
For the NextJS app directory support there is a workaround that apparently works, though I haven't tried it. This has been wrapped by MUI into a package for their consumers to use with NextJS. We could probably do the same, but if the Next supplied example works just fine, you can probably just use that as it's a one-off implementation for your app. Nothing needed from us. For pure React server components the path is less clear. Seems like most CSS-in-JS libraries are waiting on a few things for this to be a reality. We've discussed internally potentially switching to something like StyleX which would work for both, but it would mean dropping runtime style computation, which I believe is still something we'd need to support for some Twilio applications, specifically Flex. If it's just app directory support in Next, try the example in the NextJS repo, and that should get you rolling. Let us know how you get on. |
Beta Was this translation helpful? Give feedback.
Hi @IObert
We're somewhat at the mercy of Emotion CSS right now, and Material UI is in the same boat as us, FWIW.
There seems to be a couple threads;
For the NextJS app directory support there is a workaround that apparently works, though I haven't tried it. This has been wrapped by MUI into a package for their consumers to use with NextJS. We could probably do the same, but if the Next supplied example works just fine, you can probably just use that as it's a one-off implementation for your app. Nothing needed from us.
For pure React server components the path is less clear. Seems…