forwardRef-test.internal.js — react Source File
Architecture documentation for forwardRef-test.internal.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
'use strict';
describe('forwardRef', () => {
let React;
let ReactNoop;
let Scheduler;
let waitForAll;
beforeEach(() => {
jest.resetModules();
React = require('react');
ReactNoop = require('react-noop-renderer');
Scheduler = require('scheduler');
const InternalTestUtils = require('internal-test-utils');
waitForAll = InternalTestUtils.waitForAll;
});
it('should work without a ref to be forwarded', async () => {
class Child extends React.Component {
render() {
Scheduler.log(this.props.value);
return null;
}
}
function Wrapper(props) {
return <Child {...props} ref={props.forwardedRef} />;
}
const RefForwardingComponent = React.forwardRef((props, ref) => (
<Wrapper {...props} forwardedRef={ref} />
));
ReactNoop.render(<RefForwardingComponent value={123} />);
await waitForAll([123]);
});
it('should forward a ref for a single child', async () => {
class Child extends React.Component {
render() {
Scheduler.log(this.props.value);
return null;
}
}
function Wrapper(props) {
return <Child {...props} ref={props.forwardedRef} />;
}
// ... (169 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does forwardRef-test.internal.js do?
forwardRef-test.internal.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is forwardRef-test.internal.js in the architecture?
forwardRef-test.internal.js is located at packages/react/src/__tests__/forwardRef-test.internal.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free