MCPcopy Create free account
hub / github.com/SuboptimalEng/coding-tutorials / handleScroll

Function handleScroll

react-infinite-scroller/pages/index.jsx:20–34  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

18 };
19
20 const handleScroll = (e) => {
21 console.log(e.target.documentElement.scrollTop);
22 console.log(window.innerHeight);
23 console.log(e.target.documentElement.scrollHeight);
24 // console.log(
25 // Math.ceil(e.target.documentElement.scrollTop + window.innerHeight)
26 // );
27 const scrollHeight = e.target.documentElement.scrollHeight;
28 const currentHeight = Math.ceil(
29 e.target.documentElement.scrollTop + window.innerHeight
30 );
31 if (currentHeight + 1 >= scrollHeight) {
32 loadTenPokemon();
33 }
34 };
35
36 useEffect(() => {
37 loadTenPokemon();

Callers

nothing calls this directly

Calls 1

loadTenPokemonFunction · 0.85

Tested by

no test coverage detected