MCPcopy Create free account
hub / github.com/editablejs/editable / forwardRefWithAs

Function forwardRefWithAs

apps/docs/src/utils/forward-ref-with-as.tsx:77–84  ·  view source on GitHub ↗
(
  comp: (
    props: PropsFromAs<ComponentType, Props>,
    ref: React.RefObject<any>,
  ) => React.ReactElement | null,
)

Source from the content-addressed store, hash-verified

75 * @param Comp
76 */
77export function forwardRefWithAs<Props, ComponentType extends As>(
78 comp: (
79 props: PropsFromAs<ComponentType, Props>,
80 ref: React.RefObject<any>,
81 ) => React.ReactElement | null,
82) {
83 return React.forwardRef(comp as any) as unknown as ComponentWithAs<ComponentType, Props>
84}
85
86/*
87Test components to make sure our dynamic As prop components work as intended

Callers 1

heading.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…