What's new?
- Added support for functions as children. React-PDF has never been simpler to work with! Say goodbye to
onLoadSuccess
, say goodbye to setting number of pages in your own state, say goodbye to extra renders! Now, rendering a simple document is as trivial as:Thanks @adamaoc for inspiration!<Document file="sample.pdf"> {({ pdf }) => Array(pdf.numPages) .fill(null) .map((_, index) => <Page key={`page-${index}`} pageIndex={index} /> ))} </Document>
- Updated PDF.js to 5.3.93.
- Updated documentation on JPEG 2000 support.
- Updated dependencies.
- Exported
LinkService
type for convenience.
What's changed?
usePageContext
will now provide non-null value sooner than before, before the page is actually loaded. This is uniform with howuseDocumentContext
behaves and with how types were designed from the start, so you should not be affected by this change.- React-PDF now targets es2018 and not es2017. PDF.js, our core dependency, already used modern JavaScript syntax, so you should not be affected by this change.