最佳答案
我们的应用程序使用无限滚动来浏览大量的异构项目列表:
已知的、不完整的解决方案:
(反应-无限-卷轴) - This is just a simple "load more when we hit the bottom" component. It does not cull any of the DOM, so it will die on thousands of items.
(滚动位置与反应)-显示如何存储和恢复滚动位置时插入在顶部的 < em > or 插入在底部,但不一起。
我不是在寻找一个完整的解决方案的代码(尽管那样会很好)相反,我正在寻找“反应方式”来模拟这种情况。滚动位置是否处于状态?我应该跟踪什么状态以保留我在列表中的位置?我需要保持什么状态,以便我触发一个新的渲染时,我滚动接近底部或顶部的渲染?