Search code examples
scrollreactjsreactjs-flux

React flux mouse position resets when store emits a change


I have a page that displays a list of articles. Users will be browsing to the end of the page and click on "load more" to trigger an Action that loads more articles into the list inside the Store. But the react component kind of re-renders the entire page so my viewport resets to the top of the page.

Anyone know how I can solve this? Thanks.

p.s: the architecture is React Flux


Solution

  • Take a look at adding a key to each of your components. React will re-draw everything unless it knows that certain components haven't changed and so don't need redrawing.

    That would be my guess, based on the information provided.