
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
solid-infinite-scroll-fork
Advanced tools
Infinite scrolling / Dynamic list loading library for SolidJS
First, install the library from the npm registry:
yarn add -D solid-infinite-scroll
Second, import it in the tsx component you're working on:
import InfiniteScroll from 'solid-infinite-scroll';
To use the infinite scroll module, you would need a signal/resource for data storage, and implement two functions:
each
should return the currently stored data array, this is similar to the SolidJS <For>
componenthasMore
should return true if more data is availablenext
should load more data into the array stored by each
and return nothingFor example, if you want to load all data at once but only display e.g. 50 at a time, you can do:
const fetchApi = async () => await (await fetch("https://api.example.com/list").json() as string[]
export default function App() {
const [api] = createResource(fetchApi)
const [scrollIndex, setScrollIndex] = createSignal(50)
const scrollNext = () => setScrollIndex(Math.min(scrollIndex() + 50, api().length))
return (
<InfiniteScroll each={api()?.slice(0, scrollIndex())}
hasMore={scrollIndex() < api()?.length}
next={scrollNext}>
{(item, index) =>
<div>{item}</div>
}
</InfiniteScroll>
)
}
FAQs
infinite scroll library for solid-js
The npm package solid-infinite-scroll-fork receives a total of 0 weekly downloads. As such, solid-infinite-scroll-fork popularity was classified as not popular.
We found that solid-infinite-scroll-fork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.