dmk99 / react-pdf-table

Storybook Available
https://dmk99.github.io/react-pdf-table
MIT License
152 stars 62 forks source link

Error in Next js 13 App routes #59

Open Dru1DD opened 8 months ago

Dru1DD commented 8 months ago

When I generate Pdf on api/route in Next Js 13 I got an error that isn't suitable as server component.

 ⨯ Class extends value undefined is not a constructor or null

This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components.

It seems, that package didn't compared for app routes

JefferMarcelino commented 8 months ago

Try to add "use client" in the beginning of the file.

Dru1DD commented 8 months ago

Try to add "use client" in the beginning of the file.

Yeah, you're right. But I have told about api/route. I generate pdf on server side with package react-pdf/renderer and method renderToStream - works only on server ( express js ) or api/route. And there it doesn't work.