@ryo-98/react-api-bridge
Version:
A registry for component imperative api
14 lines (13 loc) • 513 B
JavaScript
import { useFinalContextValue, getUpperContextValue } from "../../core/index.js";
import { useMemo } from "react";
function useUpperBoundaryPayload(apiBridge, hookOptions) {
const { shouldForwardYield } = hookOptions || {};
const contextValue = useFinalContextValue(hookOptions, apiBridge.BridgeContext);
const boundaryContextValue = useMemo(() => {
return getUpperContextValue(contextValue, shouldForwardYield);
}, []);
return boundaryContextValue?.payload;
}
export {
useUpperBoundaryPayload
};