MCPcopy
hub / github.com/facebook/react / renderForwardRef

Function renderForwardRef

packages/react-server/src/ReactFizzServer.js:2669–2715  ·  view source on GitHub ↗
(
  request: Request,
  task: Task,
  keyPath: KeyNode,
  type: any,
  props: Object,
  ref: any,
)

Source from the content-addressed store, hash-verified

2667}
2668
2669function renderForwardRef(
2670 request: Request,
2671 task: Task,
2672 keyPath: KeyNode,
2673 type: any,
2674 props: Object,
2675 ref: any,
2676): void {
2677 let propsWithoutRef;
2678 if ('ref' in props) {
2679 // `ref` is just a prop now, but `forwardRef` expects it to not appear in
2680 // the props object. This used to happen in the JSX runtime, but now we do
2681 // it here.
2682 propsWithoutRef = ({}: {[string]: any});
2683 for (const key in props) {
2684 // Since `ref` should only appear in props via the JSX transform, we can
2685 // assume that this is a plain object. So we don't need a
2686 // hasOwnProperty check.
2687 if (key !== 'ref') {
2688 propsWithoutRef[key] = props[key];
2689 }
2690 }
2691 } else {
2692 propsWithoutRef = props;
2693 }
2694
2695 const children = renderWithHooks(
2696 request,
2697 task,
2698 keyPath,
2699 type.render,
2700 propsWithoutRef,
2701 ref,
2702 );
2703 const hasId = checkDidRenderIdHook();
2704 const actionStateCount = getActionStateCount();
2705 const actionStateMatchingIndex = getActionStateMatchingIndex();
2706 finishFunctionComponent(
2707 request,
2708 task,
2709 keyPath,
2710 children,
2711 hasId,
2712 actionStateCount,
2713 actionStateMatchingIndex,
2714 );
2715}
2716
2717function renderMemo(
2718 request: Request,

Callers 1

renderElementFunction · 0.85

Calls 5

checkDidRenderIdHookFunction · 0.90
getActionStateCountFunction · 0.90
renderWithHooksFunction · 0.85
finishFunctionComponentFunction · 0.85

Tested by

no test coverage detected