When you need to show data in a table, you usually use paginate()
to split the data into pages.
In this post, Iโll explain the difference between paginate()
and cursorPaginate()
in simple terms because sometimes using one over the other can impact how fast your site runs.
1๏ธโฃ cursorPaginate()
- It uses
where
to fetch data and split it into pages. - It only allows you to go to the
next
andprevious
pages, without showing page numbers. - This method is best for large amounts of data and works well for infinite scrolling (like when you keep scrolling down and more data loads).
2๏ธโฃ paginate()
- It uses
limit
andoffset
to split data into pages. - It shows you page numbers, along with
next
andprevious
buttons. - If you have a lot of data, this method can slow down your site, and the more data you have, the slower it gets.
If you found this post helpful, Iโd love it if you could interact with it or share it ๐ค.
And donโt forget to follow me on my social media accounts for more updates and tips!
Stay safe and blessed ๐
SHARE: