Open wzrdx opened 2 months ago
I'm having the same issue
I created a client component for rendering block content.
import Image from "next/image";
import {
BlocksRenderer,
type BlocksContent,
} from "@strapi/blocks-react-renderer";
export default function BlockRendererClient({
content,
}: {
readonly content: BlocksContent;
}) {
if (!content) return null;
return (
<BlocksRenderer
content={content}
blocks={{
image: ({ image }) => {
console.log(image);
return (
<Image
src={image.url}
width={image.width}
height={image.height}
alt={image.alternativeText || ""}
/>
);
},
}}
/>
);
}
What version of
@strapi/blocks-react-renderer
are you using?What's Wrong?
I am trying to use the BlocksRenderer inside a server component in my NextJS app. I want to pass a custom component for links.
I get the following error:
To Reproduce
Create a NextJS app using the /app router and create a new page (page.tsx).
Render the BlocksRendered inside of it and try to pass a custom component.
Expected Behaviour
The page should render without errors.