What's the recommended way to inject content between hits with React Instantsearch Hooks?

There’s documentation here for injecting content between hits with React Instantsearch: Injecting content between hits | Algolia – but I’m using React Instantsearch Hooks.

I can’t find equivalent documentation for the Hooks version.

At the moment we’re looping through the hits and adding something else now and then, but things get messy with pagination.

What’s the recommended way to inject content between hits with React Instantsearch Hooks?

@bjn welcome to the communtiy!

I looked around on our documentation and internally, there doesn’t seem to be a guide for the Hooks version yet, only the regular library.

I will pose this question to our internal team and see if anyone has a good example or recommendation

1 Like

@bjn A team member mentioned this project uses React Hooks and has content injection:

Live Preview

GitHub Repo:

Thanks for that.

It looks like it’s essentially doing exactly what we are – it’s splicing other content in to the array of hits. There’s nothing in there that I can see that would help keep page lengths consistent if for example we run out of injectable content after a couple of pages.