Struggling with a react-pdf issue in my next js project despite following various tutorials.
The error message I receive is:
⨯ Instead change the require of react-pdf.js in C:\Users\TCET ADMIN\Desktop\next\.next\server\app\(client)\page.js to a dynamic
import() which is available in all CommonJS modules.
at @react-pdf/renderer (C:\Users\TCET ADMIN\Desktop\next\.next\server\app\(client)\page.js:110:18)
... more errors listed here ...
https://i.sstatic.net/WikcImRw.png
Despite trying multiple tutorials, my approach involved creating custom components and passing different props to them. Below are snippets from my code:
MainComponent.tsx
<DownloadButton
disabledButton={!confirmAgreement}
onClick={form.handleSubmit(onSubmit)}
isPending={isPending}
form={form} />
</DialogClose>
DownloadButton.tsx
'use client'
import React from 'react'
... more code snippet continued here ...
And then this my CreateAppointmendPDF.tsx file where I encounter issues using features from @react-pdf/renderer
.
import { Document, Font, Page, Text, View } from '@react-pdf/renderer'
const CreateDocumentPDF = ({
form
}: any) => {
return (
<Document>
... content here ...
</Document>
)
}
export default CreateDocumentPDF