Objects are not valid as a React child React Origin: On your device Last updated 13 Oct 2026

Error: Objects are not valid as a React child

You tried to render a plain object (or a Promise/Date) directly in JSX; React can only render strings, numbers, elements and arrays of them.

Exact message you may see Objects are not valid as a React childIf you meant to render a collection of children, use an array instead
Seen on: React

Meaning

JSX like {user} where user is an object can’t be turned into DOM. React lists the object’s keys in the error (“found: object with keys {id, name}”) — a great hint about which value it is.

Common causes

  • Rendering an object instead of one of its properties ({user} vs {user.name})
  • Rendering a Date object (use .toLocaleDateString())
  • Rendering an API error object directly
  • An async component returning a Promise (outside server components)

⚡ Quick fix

  1. Render a property: {user.name}
  2. Format dates: {date.toLocaleDateString()}
  3. Debug-render with <pre>{JSON.stringify(obj, null, 2)}</pre>
  4. Map arrays of objects to elements

Detailed fix by platform

React

  1. Example:
    jsx
    <p>{error}</p>            // ❌ error is { message, code }
    <p>{error.message}</p>    // ✅

How to diagnose

  1. Keys in error — Which object has those keys?
  2. JSX — Where is that value rendered?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Adjacent JSX elements — Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (React)Adjacent JSX elementsElement type is invalid — Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined (React)Element type is inval…Functions not valid as child — Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. (React)Functions not valid a…Hydration failed — Error: Hydration failed because the initial UI does not match what was rendered on the server (React)Hydration failedInvalid DOM property — Warning: Invalid DOM property `class`. Did you mean `className`? (React)Invalid DOM propertyMinified React error — Error: Minified React error #31; visit https://react.dev/errors/31 for the full message (React)Minified React errornon-boolean attribute — Warning: Received `true` for a non-boolean attribute `x`. (React)non-boolean attributeNothing was returned from render — Error: Nothing was returned from render. This usually means a return statement is missing. (React)Nothing was returned …Objects a…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.