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 (containsvalueproperty).isFetching—booleanindicating if the request is in flight.isError—booleanindicating if an error occurred.