React algolia in HOC

Hi
Im using react-instantsearch with react and redux
Recently I’ve been surfing all the examples and documents of algolia, but I have a question about where the InstantSearch searchClient should be put in a React Component.

Since the current component I’m using can’t be rewritten to functional component, so useMemo hook is not an option, and also I won’t get algolia key and id until runtime, currently I initialized it at contructor and save it into state to prevent recreating searchClient when rendered.

So is this the right way to place a searchClient for InstantSearch in React Components?