You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You have to call setPages after the PDFViewer component is mounted else it is rendering again while its getting rendered and throwing the error. Use it like below
import React, { useState, useEffect } from 'react'
import PDFViewer from 'pdf-viewer-reactjs'
Hello,
I'm trying to set the number of pages using useState, but unfortunately, it's crashing.
Describe the bug
I'm trying to use getMaxPageCount with useState
but I've got this error on the console
react_devtools_backend.js:2430 Error while reading the pages ! TypeError: Cannot read property 'getPage' of null
Expected behavior
the value of pages should best st to the number of pages
What will be awesome is to have a prop like onLoaded that takes a function how to allow us to do some stuff when the pdf was loaded whit success
Have a nice day, thank you for your help
The text was updated successfully, but these errors were encountered: