Objects are not valid as a React child: what React accepts
React renders primitives, null and elements, not plain objects. Find the object leaking into JSX, then render a field or serialize it deliberately.

Introduction & Quick Summary
Uncaught Error: Objects are not valid as a React child
(found: object with keys {id, name, createdAt}).
If you meant to render a collection of children, use an array instead.React renders strings, numbers, null, undefined, booleans, arrays of those, and React elements. Anything else that has a $$typeof of its own is fine; a plain object is not. When JSX places an object between tags or passes one as children, React throws at render time with the keys of the offending object, which is usually enough to identify the field.
The six shapes that cause it:
- A whole API object in JSX.
{user}instead of{user.name}. - A
Date,Map,Setor class instance. All objects, none renderable. - A promise handed to a component. In React 19 an unawaited promise surfaces as this error inside the boundary that tries to render it.
- An array of objects. Arrays are allowed, but their elements are checked, so
items.map((i) => i)fails on the first item. childrentyped loosely. A component that spreads{...props}into a DOM node passes the object straight through.- A ternary returning an object.
{isOpen && dialogConfig}looks conditional but ships an object when true.
| Expression | Renders? | Error text |
|---|---|---|
{user.name} | Yes | n/a |
{user} | No | found: object with keys {...} |
{new Date()} | No | found: object with keys {} |
{[1, 2, 3]} | Yes | n/a |
{[{ a: 1 }]} | No | Same, pointing at the element |
{Promise.resolve(1)} | No, React 19 | A component suspended or object error |
{() => 1} | No | Functions are not valid as a React child |
Core Mechanics, Signatures & Reproducible Setup
React.Children and the reconciler classify children before rendering. Strings, numbers and bigints become text nodes, null/undefined/booleans render as nothing, arrays and iterables are flattened, and elements are matched by $$typeof (react.element, react.transitional.element in React 19). A plain object fails every branch and throws with describeObjectForErrorMessage, which lists up to a handful of own keys.
Reproduce it with a single component:
const user = { id: 1, name: "Ada", createdAt: new Date() };
function Profile() {
return <p>{user}</p>;
}
// Uncaught Error: Objects are not valid as a React child (found: object with keys {id, name, createdAt})The fix is to select a primitive at the boundary:
function Profile() {
return (
<p>
{user.id} {user.name} {user.createdAt.toISOString()}
</p>
);
}A serializer helper keeps deep objects from leaking into JSX at all:
function asText(value: unknown): string {
if (value === null || value === undefined) return "";
if (typeof value === "string" || typeof value === "number") return String(value);
if (value instanceof Date) return value.toISOString();
if (Array.isArray(value)) return value.map(asText).join(", ");
if (typeof value === "object") return JSON.stringify(value);
return String(value);
}
// <span>{asText(payload.detail)}</span>That helper is also the pragmatic answer when the payload shape is unknown at the edge of the app and only needs to be visible for debugging.
Key Comparison Table
| Value type | React child? | Correct render path |
|---|---|---|
string, number | Yes | Direct |
boolean | Yes, renders nothing | Use for conditionals |
null, undefined | Yes, renders nothing | Guard clauses |
Date | No | toISOString() or Intl.DateTimeFormat |
Map, Set | No | Convert with Array.from |
| Plain object | No | Destructure or serialize |
| Array of primitives | Yes | Map to strings |
| Array of elements | Yes | map with key |
| Situation | Why it happens | Practical fix |
|---|---|---|
{data} from useQuery | The whole query result is an object | Render data.title |
{error} from a catch | Error instances are objects | Render error.message |
{children} passed as config | A config object reaches JSX | Flatten before render |
Object inside <option> | <option>{obj}</option> | Use obj.label |
| Object in a template literal | Silent [object Object], no throw | Same fix, worse symptom |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
Case 1: An object spread into a DOM element
function Badge(props: { children: React.ReactNode; tone?: object }) {
return <span {...props} />;
}{...props} places tone on a DOM node, and React serializes unknown props as attributes, which fails once the value is an object. Destructure the props you intend to forward:
function Badge({ children, tone, ...rest }: BadgeProps) {
return <span data-tone={String(tone)} {...rest}>{children}</span>;
}Case 2: A conditional that returns a config object
{isOpen && { title: "Confirm", body: "Sure?" }}This is a valid boolean-AND in JavaScript and an invalid child in React. Use a ternary with null on the false branch and render fields explicitly.
Case 3: Map rendered directly
const totals = new Map([["eu", 10], ["us", 20]]);
return <ul>{totals}</ul>; // objects are not valid as a React childreturn (
<ul>
{[...totals].map(([region, amount]) => (
<li key={region}>{region}: {amount}</li>
))}
</ul>
);Case 4: An unawaited promise from an async function
async function loadName() { return "Ada"; }
function Name() {
const name = loadName(); // Promise
return <span>{name}</span>;
}React 19 can surface this as the object error rather than a suspension warning when the promise has already settled, which makes it trickier to spot. Await it in the caller or use use() inside a component that is wrapped in Suspense.
Case 5: useId-style objects in a list
const rows = [{ key: { id: 1 }, label: "A" }];
return rows.map((r) => <li key={r.key}>{r.label}</li>);The key prop is special and does accept objects for identity purposes, but rendering r.key elsewhere throws. Keep a stable primitive identifier for both.
Case 6: Server data through a form action
const [state, formAction] = useActionState(save, { error: null, fields: {} });
return <form action={formAction}><p>{state}</p></form>;Render state.error and iterate state.fields, not the state object itself. The same pattern catches people migrating from useFormState.
Common Compilation/Runtime Mistakes & Version Gotchas
- React 19 error identity changed. The thrown object is now a plain
Errorwith a structured message; error boundaries that matched on message text need updating. React.Children.toArrayis not a serializer. It flattens and keys children but keeps objects as objects, so it will not rescue a bad payload.String(obj)in JSX passes silently.{"Name: " + obj}rendersName: [object Object]with no throw, which is worse than the error because it reaches production. Prefer explicit field access.- Fragments mask the location.
<>{obj}</>reports the fragment's parent, not the exact expression, so search the component for object-typed props when the stack is unhelpful. - Server Components. Passing an object as
childrenfrom a server component to a client component is allowed and serialized, but rendering it there throws the same way. The rule is about rendering, not passing. - TypeScript does not catch it.
ReactNodeexcludes plain objects, so typed code usually fails at compile time, meaning most occurrences come fromany, index signatures, or untyped JS.
For payloads that arrive as JSON from an API, prettify them in the JSON formatter to see the actual shape before writing JSX, and compare a failing response with a known-good one using the diff tool. If the object comes from a YAML config rendered into a docs page, the YAML viewer catches type mistakes such as a date being parsed as an object.
Primary references: React's rendering rules for children and the isValidElement check describe exactly what the reconciler accepts.
Official references
primary documentationThe React documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit React work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related React guides
All React guidesReact 19: Support for defaultProps will be removed
React 19 ignores defaultProps on function components, so a default becomes undefined. Move defaults into the parameter list and handle null honestly.
react-hook-form with zod 4: resolver type errors after the upgrade
Zod 4 split input from output and resolvers v5 re-typed Resolver. Drop the generic, or pass all three, and the errors disappear.
React Profiler API: Measuring Render Timings and Identifying Wasted Re-Renders
actualDuration versus baseDuration, phase names that tell you who triggered a commit, and how to ship the numbers without flooding a backend.
React: Each child in a list should have a unique key prop
Keys tell React which item is which between renders. Use stable ids, avoid index keys and put the key on the mapped element, not on a wrapper.
More in React
All React guidesThe guides filed next to this one in React, in library order.