I have a table setup using the Infinite Scroll example at htmx.org. The initial hx-get
is set to something like /new?limit=10&page=1
.
The /new
handle populates the data and displays page=1
, and the last row of the table has another hx-get
as per the pattern with another page=2
, but I have no idea how to increment this value other than on the server side as the user scrolls past the second page
without resorting to cookies or data structures.
Can this be accomplished without complexity of maintaining state on the server side (which is golang in this case?
Your endpoint /new?limit=10&page=2
receives all the parameters for the next page, all you need to do is to form a URL for the next page using those parameters and increasing the page number.
So you don't need any state on the server side.