facebook/react · error · Error

31

31

Error message

Objects are not valid as a React child (found: ${childString === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : childString}). If you meant to render a collection of children, use an array instead.

What it means

Error "Objects are not valid as a React child (found: ${childString === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : childString}). If you meant to render a collection of children, use an array instead." thrown in facebook/react.

Source

Thrown at packages/react-reconciler/src/ReactChildFiber.js:315

  // should always read the ref from the prop.
  workInProgress.ref = refProp !== undefined ? refProp : null;
}

function throwOnInvalidObjectTypeImpl(returnFiber: Fiber, newChild: Object) {
  if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE) {
    throw new Error(
      'A React Element from an older version of React was rendered. ' +
        'This is not supported. It can happen if:\n' +
        '- Multiple copies of the "react" package is used.\n' +
        '- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n' +
        '- A compiler tries to "inline" JSX instead of using the runtime.',
    );
  }

  // $FlowFixMe[method-unbinding]
  const childString = Object.prototype.toString.call(newChild);

  throw new Error(
    `Objects are not valid as a React child (found: ${
      childString === '[object Object]'
        ? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
        : childString
    }). ` +
      'If you meant to render a collection of children, use an array ' +
      'instead.',
  );
}

function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
  const debugTask = getCurrentDebugTask();
  if (__DEV__ && debugTask !== null) {
    debugTask.run(
      throwOnInvalidObjectTypeImpl.bind(null, returnFiber, newChild),
    );
  } else {
    throwOnInvalidObjectTypeImpl(returnFiber, newChild);

View on GitHub (pinned to eafeac097b)

When it happens

Trigger: Thrown at packages/react-reconciler/src/ReactChildFiber.js:315 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/bf3b9ab83f786a0f. Report an issue: GitHub.