useProviders
Hook that returns providers.
Usage
import React from 'react';
import { useProviders } from '@availity/hooks';
const Example = () => {
const { data, isFetching } = useProviders({ customerId: '01234' });
return (
<div>
{isFetching
? 'Loading...'
: data?.data?.providers?.[0]?.lastName || 'Dr. Availity'}
</div>
);
};
Parameters
config: AvProvidersConfig
Configuration object containing customerId (string) and any additional properties to pass to getProviders from @availity/api-axios.
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 providers response object.isFetching—booleanindicating if the request is in flight.isError—booleanindicating if an error occurred.