0

I want to create components while scrolling. Is it a good idea to use lodash's range method and increase it?

It looks like this:

_.range(4);
// => [0, 1, 2, 3]

So i can do something like this:

_.range(someState)

and in onWheel event I would just increment someState.

I'm not sure if this is a good idea tho. What do you think?

sympi
  • 535
  • 2
  • 7
  • 14
  • do you mean you want an infinite scroll type thing? – Daniel A. White Mar 27 '17 at 10:38
  • I'm not sure if this is a solution but you could have a look at [react-infinite-scroller](https://github.com/CassetteRocks/react-infinite-scroller). Basically, the lib is listening to a scroll event and renders elements with React.createElement. – Clafou Mar 27 '17 at 10:45
  • Yes, I want infinite scroll type thing :) – sympi Mar 27 '17 at 10:46
  • Possible duplicate of [Infinite scrolling with React JS](http://stackoverflow.com/questions/21238667/infinite-scrolling-with-react-js) – Martin Mihaylov Mar 27 '17 at 10:50

0 Answers0