Home / File/ refs-destruction-test.js — react Source File

refs-destruction-test.js — react Source File

Architecture documentation for refs-destruction-test.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';

let React;
let ReactDOM;
let ReactDOMClient;
let TestComponent;
let act;
let theInnerDivRef;
let theInnerClassComponentRef;

describe('refs-destruction', () => {
  beforeEach(() => {
    jest.resetModules();

    React = require('react');
    ReactDOM = require('react-dom');
    ReactDOMClient = require('react-dom/client');
    act = require('internal-test-utils').act;

    class ClassComponent extends React.Component {
      render() {
        return null;
      }
    }

    TestComponent = class extends React.Component {
      constructor(props) {
        super(props);
        theInnerDivRef = React.createRef();
        theInnerClassComponentRef = React.createRef();
      }

      render() {
        if (this.props.destroy) {
          return <div />;
        } else if (this.props.removeRef) {
          return (
            <div>
              <div />
              <ClassComponent />
            </div>
          );
        } else {
          return (
            <div>
              <div ref={theInnerDivRef} />
              <ClassComponent ref={theInnerClassComponentRef} />
            </div>
          );
        }
      }
// ... (121 more lines)

Domain

Subdomains

Frequently Asked Questions

What does refs-destruction-test.js do?
refs-destruction-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is refs-destruction-test.js in the architecture?
refs-destruction-test.js is located at packages/react-dom/src/__tests__/refs-destruction-test.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free