Get results as JSON

Hi!
I’m built a simple UI and used the searchBox widget to perform the search.

I’m trying to access a JSON response with the hits, so I can iterate over it and show the results using my own HTML structure. I need to add some interaction to the UI that won’t be possible with the HTML templates provided by the hits widget.

So is there a way to access the JSON file of the hits returned by the search query?

Thank you!

I’m wondering if the best solution would be to create a custom hits widget?
I hope there’s a more direct way to access the ‘hits’ from the search object. But this is what I’ve tried with the custom widget without much success:

	// Create the render function
	const renderHits = (renderOptions, isFirstRender) => {
		const { hits } = renderOptions;
		if (isFirstRender) {
			return;
		}
		console.log(hits);
	};

	// Create the custom hit widget
	const customHits = connectHits(renderHits);

Then I’m initializing the custom widget:

	onMount(() => {
		algolia.addWidgets([
			searchBox({
				container: '#searchbox',
			}),

			customHits({})
		]);
		algolia.start();
	});

Once the page loads the console prints the JSON response perfectly.
But It doesn’t print again as I change the search query, indicating the results are not updated.