MCPcopy Create free account
hub / github.com/adobe/react-spectrum / composeRenderProps

Function composeRenderProps

packages/react-aria-components/src/utils.tsx:288–294  ·  view source on GitHub ↗
(
  // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage
  value: T extends any ? T | ((renderProps: U) => V) : never,
  wrap: (prevValue: T, renderProps: U) => V
)

Source from the content-addressed store, hash-verified

286 * function), and combines it with another value to create a final result.
287 */
288export function composeRenderProps<T, U, V extends T>(
289 // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage
290 value: T extends any ? T | ((renderProps: U) => V) : never,
291 wrap: (prevValue: T, renderProps: U) => V
292): (renderProps: U) => V {
293 return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);
294}
295
296export type WithRef<T, E> = T & {ref?: ForwardedRef<E>};
297export interface SlotProps {

Callers 15

TabsFunction · 0.90
TabListFunction · 0.90
TabFunction · 0.90
TabPanelFunction · 0.90
HorizontalCard.tsxFile · 0.85
Popover.tsxFile · 0.85
CustomDialog.tsxFile · 0.85
TextField.tsxFile · 0.85
Dialog.tsxFile · 0.85
Card.tsxFile · 0.85

Calls 1

wrapFunction · 0.85

Tested by

no test coverage detected