papi-dts
    Preparing search index...
    • Creates a hook that returns the network object for a source, or undefined.

      undefined conflates "not yet", "nothing to ask for", and "asking failed", and across a source change this keeps serving the PREVIOUS source's object until the new lookup settles — so a consumer whose source can change in place should use createUseNetworkObjectStateHook instead, whose union can tell those apart. See NetworkObjectState.

      If the new lookup rejects, this serves undefined rather than keeping the previous object, which answers for a source the caller is no longer asking about.

      Type Parameters

      • THookParams extends unknown[]

      Parameters

      • ...createArgs: [
            getNetworkObject: (
                ...args: THookParams,
            ) => Promise<undefined | NetworkObject<object>>,
            mapParametersToNetworkObjectSource?: (
                ...args: THookParams,
            ) => undefined | string | NetworkObject<object>,
            doesCreatedNetworkObjectMatchSource?: (
                networkObjectDetails: NetworkObjectDetails,
                networkObjectSource: string,
            ) => boolean,
        ]

      Returns (...args: THookParams) => undefined | NetworkObject<object>

      A function that takes in a networkObjectSource and returns the network object, or undefined