I have a Page
component in my React application with the size of A4 page. Inside this Page
component I have multiple different nested children. However I came across a problem.
Problem lays when children of one Page
component overflow it's height. How can I create another instance of Page
component and move children that are overflowing to that component. Also, if possible, for solution to be recursive because n Page
component can also have children that are overflowing it's height.
I tried multiple different solutions but all of them were either ineffective or full of bugs.
I have a page component:
const Page = ({ children }) => {
return <div style={{ width: A4.width, height: A4.height }}> {children} </div>
}
And this is in some particular container:
const Container = () => {
return (
<Page>
<div className="child" />
<div className="child" />
{/* This should be moved into another Page instance programmatically */}
<div className="child" />
</Page>
}
}
And this is my CSS:
.child {
position: relative;
width: 100%;
height: 50%;
border: 2px solid black;
}
NOTE: This question does not refer and is not identical as this one: How to make a HTML Page in A4 paper size page(s)? I need a way to dynamically create containers and append children from previous containers that are overflowing the height of said previous containers.