Laravel

Livewire Infinite Scroll Pattern

January 16, 2026 1 min read 35 views

Infinite scroll:

Component

public int $perPage = 10;

public function loadMore()
{
    $this->perPage += 10;
}

#[Computed]
public function posts()
{
    return Post::latest()->take($this->perPage)->get();
}

View

@foreach($this->posts as $post)
    
{{ $post->title }}
@endforeach
Loading more...

With Alpine Intersect

x-intersect.full="$wire.loadMore()"
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!