import { Record } from '../types'; import { Refetch } from '../dataProvider'; interface Option { id: string; reference: string; } export interface UseReferenceProps { loading: boolean; loaded: boolean; referenceRecord?: Record; error?: any; refetch: Refetch; } /** * @typedef ReferenceProps * @type {Object} * @property {boolean} loading: boolean indicating if the reference is loading * @property {boolean} loaded: boolean indicating if the reference has loaded * @property {Object} referenceRecord: the referenced record. */ /** * Fetch reference record, and return it when available * * The reference prop should be the name of one of the components * added as child. * * @example * * const { loading, loaded, referenceRecord } = useReference({ * id: 7, * reference: 'users', * }); * * @param {Object} option * @param {string} option.reference The linked resource name * @param {string} option.id The id of the reference * * @returns {ReferenceProps} The reference record */ export declare const useReference: ({ reference, id }: Option) => UseReferenceProps; export default useReference;