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

Function fn

packages/react/src/__tests__/forwardRef-test.js:202–220  ·  view source on GitHub ↗
(props, ref)

Source from the content-addressed store, hash-verified

200
201 it('should use the inner name in the stack', async () => {
202 const fn = (props, ref) => {
203 return [<span />];
204 };
205 Object.defineProperty(fn, 'name', {value: 'Inner'});
206 const RefForwardingComponent = React.forwardRef(fn);
207 ReactNoop.render(
208 <p>
209 <RefForwardingComponent />
210 </p>,
211 );
212 await waitForAll([]);
213 assertConsoleErrorDev([
214 'Each child in a list should have a unique "key" prop.' +
215 '\n\nCheck the top-level render call using <ForwardRef(Inner)>. It was passed a child from ForwardRef(Inner). ' +
216 'See https://react.dev/link/warning-keys for more information.\n' +
217 ' in span (at **)\n' +
218 ' in Inner (at **)',
219 ]);
220 });
221
222 it('can use the outer displayName in the stack', async () => {
223 const RefForwardingComponent = React.forwardRef((props, ref) => {

Callers 10

captureAssertionFunction · 0.50
memoizeWithWeakMapFunction · 0.50
markAllParentsByPathFunction · 0.50
captureAssertionFunction · 0.50
index.jsFile · 0.50
handleErrorsFunction · 0.50
handleErrorsFunction · 0.50

Calls 2

waitForAllFunction · 0.85
renderMethod · 0.65

Tested by

no test coverage detected