Home / File/ ReactDOMNullInputValuePropHook.js — react Source File

ReactDOMNullInputValuePropHook.js — react Source File

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

File javascript BabelCompiler Validation 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  b67411db_4c43_ad15_a175_b780c7f60ac2["ReactDOMNullInputValuePropHook.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b --> b67411db_4c43_ad15_a175_b780c7f60ac2
  4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"]
  4ae326e8_2c2e_2843_d5a5_16edbddd103a --> b67411db_4c43_ad15_a175_b780c7f60ac2
  style b67411db_4c43_ad15_a175_b780c7f60ac2 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.
 */

let didWarnValueNull = false;

export function validateProperties(type, props) {
  if (__DEV__) {
    if (type !== 'input' && type !== 'textarea' && type !== 'select') {
      return;
    }

    if (props != null && props.value === null && !didWarnValueNull) {
      didWarnValueNull = true;
      if (type === 'select' && props.multiple) {
        console.error(
          '`value` prop on `%s` should not be null. ' +
            'Consider using an empty array when `multiple` is set to `true` ' +
            'to clear the component or `undefined` for uncontrolled components.',
          type,
        );
      } else {
        console.error(
          '`value` prop on `%s` should not be null. ' +
            'Consider using an empty string to clear the component or `undefined` ' +
            'for uncontrolled components.',
          type,
        );
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does ReactDOMNullInputValuePropHook.js do?
ReactDOMNullInputValuePropHook.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 ReactDOMNullInputValuePropHook.js?
ReactDOMNullInputValuePropHook.js defines 1 function(s): validateProperties.
What files import ReactDOMNullInputValuePropHook.js?
ReactDOMNullInputValuePropHook.js is imported by 2 file(s): ReactDOMComponent.js, ReactFizzConfigDOM.js.
Where is ReactDOMNullInputValuePropHook.js in the architecture?
ReactDOMNullInputValuePropHook.js is located at packages/react-dom-bindings/src/shared/ReactDOMNullInputValuePropHook.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/shared).

Analyze Your Own Codebase

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

Try Supermodel Free