Passing state to instantsearch

Hi, I’m currently using InstantSearch with React.
I would like to pass in a custom search query when a user makes a search.

    const searchClient = {
      async search(requests) {
        requests[0].params.query = this.state.searchQuery; // this.state is undefined
        return algoliaSearchClient.search(requests);
      },
      async searchForFacetValues(requests) {
        return algoliaSearchClient.searchForFacetValues(requests);
      }
    };
            <InstantSearch
              indexName="books"
              searchClient={searchClient}
              state={this.state}
            >

How do I pass in this.state such that searchClient can get my custom query?

Thank you

This can be done with the prop searchState, although I’d suggest that you use a widget for it, as said here: https://www.algolia.com/doc/guides/building-search-ui/widgets/customize-an-existing-widget/react/#apply-default-value-to-widgets

Hope that helps!