Debugging: Fix Uncaught Error Objects are not valid as a React child

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


This error might happen because you’ve got a React component and you’re rendering a prop in the JSX, like this, but you forgot to destructure the prop when initializing the component parameters:

function MyComponent(test) {
	return <p>{test}</p>
}

You should do this instead:

function MyComponent({ test }) {
	return <p>{test}</p>
}

The component receives a props object and we commonly use object destructuring to get the props “mapped” to variables, like {test} in our example.

Lessons in this unit:

0: Introduction
1: How to handle errors in React
2: Fix the “Objects are not valid as a React child” error
3: ▶︎ Fix Uncaught Error Objects are not valid as a React child
4: How to use useEffect callback with event callbacks
5: How to debug a React application
6: How to fix the dangerously SetInnerHTML did not match error in React
7: React, how to fix the TypeError: resolver is not a function error
8: How to fix the "cannot update a component while rendering a different component" error in React
9: Testing React components
10: How to configure HTTPS in a React app on localhost