import type { NetworkResponseObject } from '../core/cache'; import { type ExtractReadFromStore, type IsographEntrypoint, } from '../core/entrypoint'; import { type FragmentReference } from '../core/FragmentReference'; import { type NetworkRequestReaderOptions } from '../core/read'; import { useResult } from './useResult'; export function FragmentReader< TResult, TRawResponseType extends NetworkResponseObject, TEntrypoint extends IsographEntrypoint, TChildrenResult, >({ fragmentReference, networkRequestOptions, children, }: { fragmentReference: FragmentReference< ExtractReadFromStore, TResult >; networkRequestOptions?: Partial; children: (data: TResult) => TChildrenResult; }): TChildrenResult { const result = useResult(fragmentReference, networkRequestOptions); return children(result); }