So I have a feeling React is just going to be the wrong tool for this job (since React is very much about one direction flow), but I figured I would ask.
Say I have the following HTML:
<div class="container">
<div class="module">
<div class="row">First Row</div>
<div class="row">Second Row</div>
<div class="row">Third Row</div>
</div>
</div>
Now say that container class divs have a max height that only allows it to display the first and second row, causing the third flow to overflow.
When this occurs, I want to move the overflowed rows into a new container, so I have the following output:
<div class="container">
<div class="module">
<div class="row">First Row</div>
<div class="row">Second Row</div>
</div>
</div>
<div class="container">
<div class="module">
<div class="row">Third Row</div>
</div>
</div>
Without React, I plan to do this by passing my data structure into a render()
call, creating the html in the first code example, then iterating through each module (then row), find out if the bottom pixel value is greater than the container's max height, and if so re-render it split.
I would like to do this in Reactjs, by making each row a component that is inside a module component, but I am unsure if it's possible to accomplish this efficiently in React.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…