TWIG Load more button tutorial

Hi,

I am writing regarding this video tutorial on YouTube. This is a really cool example of TWIG use cases. But which conditions should I use to hide the “Load more” button when all the records available are loaded?

We need to compare {{ looper.count }} with the sum of the current ?load= and the initially loaded items, which can be represented as {{ 12+url.param({"key":"load"}) }} string, I guess. And as soon as the looper count gets less, then the button must be hidden.

However, initially there is no load URL parameter until we click the button for the first time. Shall we set another condition which will check if the URL paratemeter is there? I can not figure out how to solve it.

It seems like this condition statement works:

{{ looper.count }} == {{ 12+url.param({"key":"load"}) }}