diegomura / diegomura/react-pdf
Doesn't render Empty Page conditionally
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
I want to render an empty page conditionally by pageNumber or totalPages. It means that I have to use the render method on the component with `break` prop:
```jsx
pageNumber % 2 !== 0 && (
I'm only visible in even pages!
)}
/>;
```
but `break` does not work in the render method. Why? How can I do it?
It needs to double side printing document. I have an array of elements to print, but each element(can span more than one page) have to placed on new odd page.
Also I tried to use `Page` in condition rendering, but then the page numbering is broken. Like this:
```jsx
{
const isBreak = pageNumber % 2 !== 0 && pageNumber !== totalPages;
return isBreak ? (
{pageNumber}
) : null;
}} />;
```
Perhaps you have another solution for this?
React-PDF version: 4.0.0
Contributor guide
Assessment
This issue has not been assessed yet.