Next.js Discord

Discord Forum

Streamdown not working in nextjs

Unanswered
Peterbald posted this in #help-forum
Open in Discord
PeterbaldOP
using streamdown in my nextjs page:
 <Streamdown
                            components={{
                                a: ({ href, children, ...props }) => (
                                    <a
                                        href={href}
                                        className="text-purple-600 underline hover:text-purple-800"
                                        {...props}
                                    >
                                        {children} 🔗
                                    </a>
                                ),
                            }}
                        >
                            {terms}
                        </Streamdown>


and i get this error :
Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.

2 Replies

PeterbaldOP
Western paper wasp
In the Next.js App Router, you can’t pass functions (components) from a Server Component to a Client Component. You have components={{ a: (...) => (...) }} those are functions, which is why you’re getting the error.