Home / Function/ jsxDEVImpl() — react Function Reference

jsxDEVImpl() — react Function Reference

Architecture documentation for the jsxDEVImpl() function in ReactJSXElement.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ad281e06_8a7d_3988_f68c_33f816bae40c["jsxDEVImpl()"]
  1bf5591f_27a1_c79f_853a_6242549e0e07["ReactJSXElement.js"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|defined in| 1bf5591f_27a1_c79f_853a_6242549e0e07
  5b04ce0e_675c_578c_bd77_960db71fbd34["jsxProdSignatureRunningInDevWithDynamicChildren()"]
  5b04ce0e_675c_578c_bd77_960db71fbd34 -->|calls| ad281e06_8a7d_3988_f68c_33f816bae40c
  74cba079_befe_33de_79d9_e329478f8395["jsxProdSignatureRunningInDevWithStaticChildren()"]
  74cba079_befe_33de_79d9_e329478f8395 -->|calls| ad281e06_8a7d_3988_f68c_33f816bae40c
  61e1102a_51ec_ae18_0071_31d1ba8c4fe5["jsxDEV()"]
  61e1102a_51ec_ae18_0071_31d1ba8c4fe5 -->|calls| ad281e06_8a7d_3988_f68c_33f816bae40c
  79da1863_e9f9_d1a8_fbf7_51287452d2c5["validateChildKeys()"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 79da1863_e9f9_d1a8_fbf7_51287452d2c5
  04bd1671_ef17_1a3e_4550_297a31a727d2["hasValidKey()"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 04bd1671_ef17_1a3e_4550_297a31a727d2
  1b0887cd_9134_1155_2c11_e7904b1a4478["defineKeyPropWarningGetter()"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 1b0887cd_9134_1155_2c11_e7904b1a4478
  9e375f3a_dd2f_18ab_e2b2_0d6efc63b4b6["ReactElement()"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 9e375f3a_dd2f_18ab_e2b2_0d6efc63b4b6
  5c6da8c1_f2fa_cf23_63c2_fe9e5615d850["getOwner()"]
  ad281e06_8a7d_3988_f68c_33f816bae40c -->|calls| 5c6da8c1_f2fa_cf23_63c2_fe9e5615d850
  style ad281e06_8a7d_3988_f68c_33f816bae40c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react/src/jsx/ReactJSXElement.js lines 469–604

function jsxDEVImpl(
  type,
  config,
  maybeKey,
  isStaticChildren,
  debugStack,
  debugTask,
) {
  if (__DEV__) {
    // We don't warn for invalid element type here because with owner stacks,
    // we error in the renderer. The renderer is the only one that knows what
    // types are valid for this particular renderer so we let it error there.

    // Skip key warning if the type isn't valid since our key validation logic
    // doesn't expect a non-string/function type and can throw confusing
    // errors. We don't want exception behavior to differ between dev and
    // prod. (Rendering will throw with a helpful message and as soon as the
    // type is fixed, the key warnings will appear.)
    // With owner stacks, we no longer need the type here so this comment is
    // no longer true. Which is why we can run this even for invalid types.
    const children = config.children;
    if (children !== undefined) {
      if (isStaticChildren) {
        if (isArray(children)) {
          for (let i = 0; i < children.length; i++) {
            validateChildKeys(children[i]);
          }

          if (Object.freeze) {
            Object.freeze(children);
          }
        } else {
          console.error(
            'React.jsx: Static children should always be an array. ' +
              'You are likely explicitly calling React.jsxs or React.jsxDEV. ' +
              'Use the Babel transform instead.',
          );
        }
      } else {
        validateChildKeys(children);
      }
    }

    // Warn about key spread regardless of whether the type is valid.
    if (hasOwnProperty.call(config, 'key')) {
      const componentName = getComponentNameFromType(type);
      const keys = Object.keys(config).filter(k => k !== 'key');
      const beforeExample =
        keys.length > 0
          ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}'
          : '{key: someKey}';
      if (!didWarnAboutKeySpread[componentName + beforeExample]) {
        const afterExample =
          keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
        console.error(
          'A props object containing a "key" prop is being spread into JSX:\n' +
            '  let props = %s;\n' +
            '  <%s {...props} />\n' +
            'React keys must be passed directly to JSX without using spread:\n' +
            '  let props = %s;\n' +
            '  <%s key={someKey} {...props} />',
          beforeExample,
          componentName,
          afterExample,
          componentName,
        );
        didWarnAboutKeySpread[componentName + beforeExample] = true;
      }
    }

    let key = null;

    // Currently, key can be spread in as a prop. This causes a potential
    // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
    // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
    // but as an intermediary step, we will use jsxDEV for everything except
    // <div {...props} key="Hi" />, because we aren't currently able to tell if
    // key is explicitly declared to be undefined or not.
    if (maybeKey !== undefined) {
      if (enableOptimisticKey && maybeKey === REACT_OPTIMISTIC_KEY) {
        key = REACT_OPTIMISTIC_KEY;

Domain

Subdomains

Frequently Asked Questions

What does jsxDEVImpl() do?
jsxDEVImpl() is a function in the react codebase, defined in packages/react/src/jsx/ReactJSXElement.js.
Where is jsxDEVImpl() defined?
jsxDEVImpl() is defined in packages/react/src/jsx/ReactJSXElement.js at line 469.
What does jsxDEVImpl() call?
jsxDEVImpl() calls 5 function(s): ReactElement, defineKeyPropWarningGetter, getOwner, hasValidKey, validateChildKeys.
What calls jsxDEVImpl()?
jsxDEVImpl() is called by 3 function(s): jsxDEV, jsxProdSignatureRunningInDevWithDynamicChildren, jsxProdSignatureRunningInDevWithStaticChildren.

Analyze Your Own Codebase

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

Try Supermodel Free