FreshScroll
This is core component of the library. It is a wrapper around the IntersectionObserver API that provides a simple way to manipulate infinite scrolling functionality.
Props
components
Component configuration object containing:
content
React component to render each content item (required)loader
Loading indicator component (required)error
Error component or function returning an error component. Function receives a retry callback.empty
Empty state component or function returning an empty state component. Function receives a retry callback.
loadNext
Function that returns a Promise resolving to an array of items. Called when more data needs to be loaded.
initialData
Optional array of initial items to populate the list with.
observerOptions
Optional configuration options for the IntersectionObserver. See IntersectionObserver options.
containerProps
Optional props to be spread on the container div element.