diegomura / diegomura/react-pdf
usePdf Cannot read properties of null (reading 'props')
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
Package version: 2.0.20
When using **usePdf** hook, while gendering the PDF an error gets thrown.
Error message:
`TypeError: Cannot read properties of null (reading 'props')`
Stack track leads to:
- react-pdf.browser.es.js
`props = container.document.props || {};`
In the code itself I see define above:
```
var container = {
type: 'ROOT',
document: null
};
```
And accessing props on null can result in such an error.
The result is that for a split of second the **instance.error** returns an error which can be misleading for the user if we check for that property to show an error and after ±half a second the file gets generated and rendered successfully.
Contributor guide
Assessment
This issue has not been assessed yet.