API Reference / React InstantSearch Hooks / useGeoSearch()

About this Hook

The useGeoSearch Hook isn’t currently available in React InstantSearch Hooks, but you can make it yourself using useConnector() along with connectGeoSearch.

Refer to the connectGeoSearch documentation for the full API reference.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { useConnector } from 'react-instantsearch-hooks-web';
import connectGeoSearch from 'instantsearch.js/es/connectors/geo-search/connectGeoSearch';

export function useGeoSearch(props) {
  return useConnector(connectGeoSearch, props);
}

export function GeoSearch(props) {
  const {
    items,
    position,
    currentRefinement,
    refine,
    sendEvent,
    clearMapRefinement,
    isRefinedWithMap,
    toggleRefineOnMapMove,
    isRefineOnMapMove,
    setMapMoveSinceLastRefine,
    hasMapMoveSinceLastRefine,
  } = useGeoSearch(props);

  return <>{/* Your JSX */}</>;
}
Did you find this page helpful?