Skip to main content

useCurrentRegion

Hook that returns the user's current region.

Usage

import React from 'react';
import { useCurrentRegion } from '@availity/hooks';

const Example = () => {
const { data: region, isFetching } = useCurrentRegion();

return <div>{isFetching ? 'Loading...' : region?.value || 'Nowhere'}</div>;
};

Parameters

options?: QueryConfig

Options passed to the useQuery hook such as enabled and retry. See useQuery docs.

Return Value

Returns a UseQueryResult object from @tanstack/react-query. Key properties:

  • data — The current region object (contains value property).
  • isFetchingboolean indicating if the request is in flight.
  • isErrorboolean indicating if an error occurred.