Первоначальное значение мгновенного поиска

const getURLParam = (key = 's') => {
  const urlParams = new URLSearchParams(window.location.search);
  const param = urlParams.get(key);

  return param || '';
};

const App = () => {
// set initial value
const [query, setQuery] = useState(getURLParam());

return (
	<InstantSearch
          searchClient={searchClient}
          indexName="post"
          searchState={{ query }}
        >
          <SearchBox
            onChange={(e) => setQuery(e.target.value)}
          />
        {/* ... */}
     </InstantSearch>
)
}
Crazy Caracal