Objects are not valid as a React child
Last verified:
The fix
Objects are not valid as a React child: JSX got an object, a Date, or a Promise. Render a field such as user.name, or map each item to an element.
- 1
Read the found: clause
object with keys {message, code}is the object you rendered.[object Date]is a Date.[object Promise]is a Promise on React 18. Do not search the project for "use an array instead." That sentence is on every one of these crashes. - 2
Render the field, not the object
Replace
{person},{user}, or{error}withperson.name,user.email, orerror.message. A string error renders. An Error object does not. Leavestyle={{ ... }}alone. That object is not a child. If the value is a list of objects, map each one to an element and give it a stable key. If you only need a debug view, pretty-print inside one<pre>:{JSON.stringify(value, null, 2)}.String(value)on a plain object is the text[object Object].<h1>{person.name}</h1> <ul> {users.map((user) => ( <li key={user.id}>{user.email}</li> ))} </ul> - 3
Format a Date before it reaches JSX
Call
toLocaleDateString()ortoISOString()on the Date. If the formatted string differs between server and browser, format after mount or pass an ISO string through unchanged, or you trade this crash for a hydration mismatch. - 4
Await a Promise, then render a field
Do not put the Promise in the JSX. In an async Server Component,
awaitthe fetch and render a field of the result. In a Client Component, keep the resolved value in state, or pass the Promise touseinside Suspense.String(value)on a plain object is the text[object Object].
Why it happens
React will not pick a field for you. The usual generated bug is {error} when error is an object, {user} instead of {user.email}, or a Supabase or fetch response rendered directly. The JSX docs use {person} as the crash and {person.name} as the fix. The dev message is Objects are not valid as a React child (found: object with keys {name, theme}). If you meant to render a collection of children, use an array instead. Those keys are the object you put in the JSX. A Date is not a plain object, so the same check says found: [object Date]. An object passed to style={{ color: "pink" }} is an attribute, not a child.
An array of objects still throws. React walks the array, then refuses the object inside. The hint about using an array does not apply when you already passed one. On React 18, a Promise throws found: [object Promise]. React 19 unwraps a value with .then and the component suspends instead. A minified production build shows React error #31, which is this same crash.
The next error you'll probably hit
Once this is fixed, the usual follow-up is Each child in a list should have a unique "key" prop. Each child in a list should have a unique "key" prop. Put a stable id on the element returned from map. Do not use Math.random(), and do not use the array index when the list can reorder.
Prompt to paste back into your AI tool
Paste this above the error.
React throws: Objects are not valid as a React child (found: <paste the found: clause, including the keys or [object Date] or [object Promise]>). The JSX is in <file>.
Do not stringify every value in the tree. Do not wrap the component in try/catch and render null. Do not replace the object with String(value). Do not add another array around an array of objects. Do not turn style={{ }} into a child.
1. Point at the expression that renders the object, Date, or Promise.
2. Render the field we want (for example person.name or error.message). Format a Date with toLocaleDateString or toISOString. Map an array of objects to elements.
3. If the value is a Promise, await it in an async Server Component, or read it with use inside Suspense. Then render a field of the resolved value.
4. Change that expression only.Common questions
+Why does {error} work sometimes?
A string error renders. An Error object, a Supabase error object, or a plain object does not. The keys in the message tell you which one you have.
+Can I fix it with String(value)?
String on a plain object is the text [object Object]. Render the field you mean, or JSON.stringify inside one pre when you truly want the structure.
+What does found: object with keys mean?
React listed the keys of the plain object you put in JSX. Render one of those fields, such as user.name or error.message. The keys are how you find the expression. They are not a second error.
+Objects are not valid as a React child (found: [object Date]). How do I fix it?
A Date is an object, so React will not print it. Call toLocaleDateString() or toISOString() first. If the formatted string differs between server and browser, format after mount, or pass an ISO string through unchanged.
+Objects are not valid as a React child (found: [object Promise]). Is that React 19?
That found: clause is React 18. React 19 unwraps a value with .then and suspends instead of throwing this sentence. Await the fetch, or read the Promise with use inside Suspense. If you then render the resolved object, this error comes back for the object.
+What is Minified React error #31?
It is this crash in a production build. The full text is Objects are not valid as a React child (found: %s). If you meant to render a collection of children, use an array instead. Reproduce it in dev to see the keys.
+It says to use an array, and I already map an array. Why does it still throw?
The array was fine. An object inside it was not. The keys in the message are that object's keys. Map to a string or an element. An array of objects is not a collection React can print.
Related errors
- Each child in a list should have a unique "key" propEach child in a list should have a unique "key" prop. Put a stable id on the element returned from map. Do not use Math.random(), and do not use the array index when the list can reorder.CursorLovableBoltReactNext.jsOct 27, 2026
- Cannot read properties of undefined (reading 'map')The value before .map is undefined or null, so there is no array to walk. Chrome names the property in parentheses. The usual generated case is rendering a fetch result before it is an array.CursorLovableBoltReactNext.jsOct 27, 2026
- Hydration failed because the server rendered HTML didn't match the client.Hydration failed because the server rendered HTML didn't match the client. Render one tree first. Read the clock, a random value, or localStorage inside useEffect, after that first paint.CursorLovableBoltNext.jsReactNov 6, 2026
- params is a Promise and must be unwrappedparams is a Promise and must be unwrapped in Next.js 16. await params before use. Do not cast it, and do not add use client just to read it in sync.Cursorv0BoltNext.jsReactOct 20, 2026