Chaeril's avatar

Livewire pagination find if it has more pages

I wanted an infinite scroll in livewire, and then used $this->perPage which was shown on some tutorials. now in the front end, I could use

if ({{ $paginator->hasMorePages() }}) {
        @this.loadMore();
}

to make sure it won't search for more data when we know there are no pages left. but how do i validate it in component. want to make sure that when loadMore is called it also check for pages before refreshing data.

render() {
        return view('livewire.filters', [
            'paginator' => $page->paginate($this->perPage),
        ]);
}
0 likes
0 replies

Please or to participate in this conversation.