Next.js Discord

Discord Forum

After reaching the end, load more

Taiwan Dog posted this in #help-forum
Open in Discord
Taiwan DogOP
when the user scrolls to the bottom, I would like to fetch the second page
const stories = await fetchRssPosts("", 2);
I have loading.tsx like below
<Suspense fallback={<Loading />}>
    <PostFeed />

if I make the stories useState, loading.tsx would not work. How could I load another page when the user reaches the bottom?
import { fetchRssPosts } from "@/utils/rss";
import { Card } from "./Card";

export const PostFeed = async () => {
    let stories = await fetchRssPosts(

    return (
        <div className="flex flex-wrap flex-row p-4">
            {, index) => (
                <Card story={story} key={index} />

please let me know if I am misunderstanding something.

0 Replies