Home / File/ ReactDOMInput.js — react Source File

ReactDOMInput.js — react Source File

Architecture documentation for ReactDOMInput.js, a javascript file in the react codebase. 16 imports, 3 dependents.

File javascript BabelCompiler Validation 16 imports 3 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  ebd36fdb_cc70_52b6_9971_bcace1958602["ReactDOMInput.js"]
  799a7834_f34c_8596_4026_015681eee732["ReactDOMComponentTree.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 799a7834_f34c_8596_4026_015681eee732
  737f4a11_a501_8e28_d675_7c1b8ca71848["ToStringValue.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 737f4a11_a501_8e28_d675_7c1b8ca71848
  7404ee30_0cd4_7886_2806_324f301962c4["getToStringValue"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 7404ee30_0cd4_7886_2806_324f301962c4
  14e1dad9_019e_0b6b_45f9_989dc6db3084["toString"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 14e1dad9_019e_0b6b_45f9_989dc6db3084
  87cb1bb7_ad8f_2954_9806_14348a9bbec3["inputValueTracking.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 87cb1bb7_ad8f_2954_9806_14348a9bbec3
  49843596_bcbe_c41c_e960_1ffc711ed1ed["track"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 49843596_bcbe_c41c_e960_1ffc711ed1ed
  c5a0889b_7272_0f52_0356_e16d1c8072e4["trackHydrated"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> c5a0889b_7272_0f52_0356_e16d1c8072e4
  c66d3317_2d86_a8d4_7629_44de9f6a564d["updateValueIfChanged"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> c66d3317_2d86_a8d4_7629_44de9f6a564d
  fa8c5082_5952_1b00_ab76_4bbec8487a1d["getActiveElement.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> fa8c5082_5952_1b00_ab76_4bbec8487a1d
  73ae0fb8_77c3_8d4a_406e_dfdbac35c58c["getActiveElement"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 73ae0fb8_77c3_8d4a_406e_dfdbac35c58c
  c38b522a_09fe_b5a4_b72d_c1b652effb2e["escapeSelectorAttributeValueInsideDoubleQuotes.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> c38b522a_09fe_b5a4_b72d_c1b652effb2e
  4da12b01_19ae_db73_2a8b_4f1a8096aca0["escapeSelectorAttributeValueInsideDoubleQuotes"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 4da12b01_19ae_db73_2a8b_4f1a8096aca0
  2d4946a3_3487_598a_390d_fcf4897abb9b["ReactDOMEventReplaying.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 2d4946a3_3487_598a_390d_fcf4897abb9b
  9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e["ReactCurrentFiber"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> 9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e
  style ebd36fdb_cc70_52b6_9971_bcace1958602 fill:#6366f1,stroke:#818cf8,color:#fff

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.
 *
 * @flow
 */

// TODO: direct imports like some-package/src/* are bad. Fix me.
import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';

import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
import {getToStringValue, toString} from './ToStringValue';
import {track, trackHydrated, updateValueIfChanged} from './inputValueTracking';
import getActiveElement from './getActiveElement';
import {
  disableInputAttributeSyncing,
  enableHydrationChangeEvent,
} from 'shared/ReactFeatureFlags';
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';

import type {ToStringValue} from './ToStringValue';
import escapeSelectorAttributeValueInsideDoubleQuotes from './escapeSelectorAttributeValueInsideDoubleQuotes';
import {queueChangeEvent} from '../events/ReactDOMEventReplaying';

let didWarnValueDefaultValue = false;
let didWarnCheckedDefaultChecked = false;

/**
 * Implements an <input> host component that allows setting these optional
 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
 *
 * If `checked` or `value` are not supplied (or null/undefined), user actions
 * that affect the checked state or value will trigger updates to the element.
 *
 * If they are supplied (and not null/undefined), the rendered element will not
 * trigger updates to the element. Instead, the props must change in order for
 * the rendered element to be updated.
 *
 * The rendered element will be initialized as unchecked (or `defaultChecked`)
 * with an empty value (or `defaultValue`).
 *
 * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
 */

export function validateInputProps(element: Element, props: Object) {
  if (__DEV__) {
    // Normally we check for undefined and null the same, but explicitly specifying both
    // properties, at all is probably worth warning for. We could move this either direction
    // and just make it ok to pass null or just check hasOwnProperty.
    if (
      props.checked !== undefined &&
      props.defaultChecked !== undefined &&
      !didWarnCheckedDefaultChecked
    ) {
      console.error(
        '%s contains an input of type %s with both checked and defaultChecked props. ' +
          'Input elements must be either controlled or uncontrolled ' +
          '(specify either the checked prop, or the defaultChecked prop, but not ' +
// ... (427 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactDOMInput.js do?
ReactDOMInput.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactDOMInput.js?
ReactDOMInput.js defines 6 function(s): hydrateInput, initInput, restoreControlledInputState, setDefaultValue, updateInput, validateInputProps.
What does ReactDOMInput.js depend on?
ReactDOMInput.js imports 16 module(s): CheckStringCoercion, ReactCurrentFiber, ReactDOMComponentTree.js, ReactDOMEventReplaying.js, ReactFeatureFlags, ToStringValue.js, escapeSelectorAttributeValueInsideDoubleQuotes, escapeSelectorAttributeValueInsideDoubleQuotes.js, and 8 more.
What files import ReactDOMInput.js?
ReactDOMInput.js is imported by 3 file(s): ChangeEventPlugin.js, ReactDOMComponent.js, ReactFiberConfigDOM.js.
Where is ReactDOMInput.js in the architecture?
ReactDOMInput.js is located at packages/react-dom-bindings/src/client/ReactDOMInput.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/client).

Analyze Your Own Codebase

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

Try Supermodel Free