Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jatinhemnani01/svelte-infinite-scrolling

Infinite Scroll for your Svelte Project.
https://github.com/jatinhemnani01/svelte-infinite-scrolling

Last synced: 20 days ago
JSON representation

Infinite Scroll for your Svelte Project.

Awesome Lists containing this project

README

        

# Svelte Infinite Scrolling

Infinite Scroll Component for Svelte.

## Installation

```bash
npm i svelte-infinite-scrolling
```

## Demo [link](https://svelte-infinite-example.netlify.app/)

## Examples

An example of how to use the library:

```js

import { onMount } from "svelte";
import InfiniteScroll from "./InfiniteScroll.svelte";
let posts = [];
async function getPosts() {
let res = await fetch("https://meme-api.herokuapp.com/gimme/10");
let data = await res.json();
posts = [...posts, ...data.memes];
console.log(posts);
}
onMount(() => {
getPosts();
});

{#each posts as item}

{item.title}


{/each}

```

## Properties

Component props:

| Prop | Type | Default | Description |
| ----------- | -------- | ------- | ---------------------------------------- |
| `on:scroll` | function | 0 | Function You Want To Run While Scrolling |

### [Buy Me A Coffee](https://www.buymeacoffee.com/jatinhemnani01)