I have made a simple project in Laravel. I am using Livewire v^2.2.
When I add the code as described in the documentation, the previous and next buttons are dead.
The code in php Component is:
// If I comment this out, the view is horrible but is working.
// use WithPagination;
// protected $paginationTheme = 'bootstrap';
public function render()
{
return view('livewire.users', [
'users' => User::paginate(1),
]);
}
In the template:
<div>
<h1>Users</h1>
<div class="list-group">
@foreach($users as $user)
<a href="" class="list-group-item list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ $user->name }}</h5>
<small>{{ $user->created_at }}</small>
</div>
<p class="mb-1">{{ $user->email }}</p>
</a>
@endforeach
</div>
<br>
{{ $users->links() }}
</div>
I found the reason why.
Livewire components MUST have a single root element.
I forgot to add the top line in the question i see.