79079009

Date: 2024-10-11 16:17:47
Score: 1
Natty:
Report link

My Approach would involve two steps:

First, Adding a function that takes a list of objects and dynamically creating indices, in this way even if the list get modified, still the calculation remain consistent.

Second, Use the returned indices to slice data from the original list and return them whenever required, in this case when the scroll reaches the required position.

NB: If data are stored in the Database and the back-end implements OFFSET and LIMIT(Basically the given example simulates the same scenario), then, the indices can be used to create a URL by concatenating the root, endpoint and the index and use it to fetch data using GET method.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Barnabas Matonya