Why Pagination is not Working?

I want to use a basic pagination but it is not working. I wrote my code exactly same according to documentation.
Model:
namespace App\Http\Livewire\Admin;

use App\User;
use Livewire\Component;
use Livewire\WithPagination;

class Users extends Component
{
    use WithPagination;

    public function render()
    {
        return view('livewire.admin.users',[
            "users" => User::paginate(1)
        ]);
    }
}

View:











@foreach($users as $user)




Name Email Created
{!! $user->name !!}
{!! $user->email !!}
{!! $user->created_at !!}
                    </div>
                </td>
            </tr>
        @endforeach
    </tbody>
</table>
{{ $users->links() }}

Sorry :frowning:
namespace App\Http\Livewire\Admin;

use App\User;
use Livewire\Component;
use Livewire\WithPagination;

class Users extends Component
{
use WithPagination;

public function render()
{
    return view('livewire.admin.users',[
        "users" => User::paginate(1)
    ]);
}

}

I can see links but when i clicked it, anything happens.
@foreach($users as $user)
// some code
@endforeach

{{ $users->links() }}

i have the same problem
how to fix that

i have a pages 1-2 when i click is doesn’t work

Had the same issue. The problem was I did not have the entire contents of my view wrapped in a single div. Once I did this, the issue went away. Caleb warns about this, but I forgot.

1 Like

I had the same issue, fixed by wrapping the component in a single div