Home / File/ ReactDOMTextarea.js — react Source File

ReactDOMTextarea.js — react Source File

Architecture documentation for ReactDOMTextarea.js, a javascript file in the react codebase. 10 imports, 2 dependents.

File javascript BabelCompiler Validation 10 imports 2 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38["ReactDOMTextarea.js"]
  737f4a11_a501_8e28_d675_7c1b8ca71848["ToStringValue.js"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 737f4a11_a501_8e28_d675_7c1b8ca71848
  7404ee30_0cd4_7886_2806_324f301962c4["getToStringValue"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 7404ee30_0cd4_7886_2806_324f301962c4
  14e1dad9_019e_0b6b_45f9_989dc6db3084["toString"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 14e1dad9_019e_0b6b_45f9_989dc6db3084
  87cb1bb7_ad8f_2954_9806_14348a9bbec3["inputValueTracking.js"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 87cb1bb7_ad8f_2954_9806_14348a9bbec3
  49843596_bcbe_c41c_e960_1ffc711ed1ed["track"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 49843596_bcbe_c41c_e960_1ffc711ed1ed
  c5a0889b_7272_0f52_0356_e16d1c8072e4["trackHydrated"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> c5a0889b_7272_0f52_0356_e16d1c8072e4
  2d4946a3_3487_598a_390d_fcf4897abb9b["ReactDOMEventReplaying.js"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 2d4946a3_3487_598a_390d_fcf4897abb9b
  af78c51d_c7cb_3bf4_550f_f3fcc48f4f34["isArray"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> af78c51d_c7cb_3bf4_550f_f3fcc48f4f34
  9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e["ReactCurrentFiber"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b --> 8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38
  9c694103_7f39_88d0_6b4d_f9b2ffed5731["ReactFiberConfigDOM.js"]
  9c694103_7f39_88d0_6b4d_f9b2ffed5731 --> 8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38
  style 8997a27a_fcfe_cfbe_fe0c_b8a92dc76e38 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
 */

import isArray from 'shared/isArray';

import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
import {getToStringValue, toString} from './ToStringValue';
import {disableTextareaChildren} from 'shared/ReactFeatureFlags';

import {track, trackHydrated} from './inputValueTracking';
import {queueChangeEvent} from '../events/ReactDOMEventReplaying';

let didWarnValDefaultVal = false;

/**
 * Implements a <textarea> host component that allows setting `value`, and
 * `defaultValue`. This differs from the traditional DOM API because value is
 * usually set as PCDATA children.
 *
 * If `value` is not supplied (or null/undefined), user actions that affect the
 * value will trigger updates to the element.
 *
 * If `value` is supplied (and not null/undefined), the rendered element will
 * not trigger updates to the element. Instead, the `value` prop must change in
 * order for the rendered element to be updated.
 *
 * The rendered element will be initialized with an empty value, the prop
 * `defaultValue` if specified, or the children content (deprecated).
 */

export function validateTextareaProps(element: Element, props: Object) {
  if (__DEV__) {
    if (
      props.value !== undefined &&
      props.defaultValue !== undefined &&
      !didWarnValDefaultVal
    ) {
      console.error(
        '%s contains a textarea with both value and defaultValue props. ' +
          'Textarea elements must be either controlled or uncontrolled ' +
          '(specify either the value prop, or the defaultValue prop, but not ' +
          'both). Decide between using a controlled or uncontrolled textarea ' +
          'and remove one of these props. More info: ' +
          'https://react.dev/link/controlled-components',
        getCurrentFiberOwnerNameInDevOrNull() || 'A component',
      );
      didWarnValDefaultVal = true;
    }
    if (props.children != null && props.value == null) {
      console.error(
        'Use the `defaultValue` or `value` props instead of setting ' +
          'children on <textarea>.',
      );
    }
// ... (122 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactDOMTextarea.js do?
ReactDOMTextarea.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 ReactDOMTextarea.js?
ReactDOMTextarea.js defines 5 function(s): hydrateTextarea, initTextarea, restoreControlledTextareaState, updateTextarea, validateTextareaProps.
What does ReactDOMTextarea.js depend on?
ReactDOMTextarea.js imports 10 module(s): ReactCurrentFiber, ReactDOMEventReplaying.js, ReactFeatureFlags, ToStringValue.js, getToStringValue, inputValueTracking.js, isArray, toString, and 2 more.
What files import ReactDOMTextarea.js?
ReactDOMTextarea.js is imported by 2 file(s): ReactDOMComponent.js, ReactFiberConfigDOM.js.
Where is ReactDOMTextarea.js in the architecture?
ReactDOMTextarea.js is located at packages/react-dom-bindings/src/client/ReactDOMTextarea.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