React geo-search - how to add my own algolia indice?

Hey there folks :slight_smile: I have forked the geosearch example for react, in github, so I have a point of departure for working with geosearch. I have uploaded my geoloc records on my algolia dashboard, which are working as they should, but I cannot see from the forked example-code how I actually connect my own algolia indice and where I add my api and secret key? Is there someone who can let me know how I do this?
thanks in advance

Hi Linda, do you have a link to the forked example? If it’s using instantsearch, you should find the searchClient set up similar to this sandbox.

In the app.js file you will find the searchClient on line 14 where you can put in your api and secret key. You will need to enter your index name similar to line 32.

Hey there Cindy thank you so much for your quick reply :slight_smile: found it I think :slight_smile: this one right?

const searchClient = algoliasearch(

I am guessing that I need to hide this in an .env file when I deploy my app? :slight_smile:

Hi there,

That is part of it, yes! You will want to use your application ID in place of the term “latency” and your admin API key in place of the key listed there.

You don’t NEED to hide the information but having it in plain text is often not the best idea if it can be avoided.

You will also want to enter the index name on line 32, as Cindy mentioned.