Conditional pagination render

We’re using JavaScript version of instantSearch and I’m trying to determine if there are any methods/examples of how to render pagination controls conditionally. If results returned < hitsPerPage = don’t render pagination (as it’s not necessary.) Thanks in advance for any advice/insight.

Hi!

Did you take a look at this section of the documentation? https://www.algolia.com/doc/api-reference/widgets/pagination/js/#connector

It looks like using a connector might be what you’re looking for, as it’ll give you the pages count so you’d be able to decide to render nothing if the pages count is 1.

Thanks, Octave. I will have a look. Seems logical to only render UI components if needed – so if page count ≤ 1 = don’t render pagination (since the controls will be inert/disabled anyway.) Thanks again for the advice/insight – it is much appreciated!