# Fix Uncaught Error Objects are not valid as a React child

> How to fix the Uncaught Error Objects are not valid as a React child, caused by forgetting to destructure props in your component function parameters.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2023-03-27 | Topics: [React](https://flaviocopes.com/tags/react/) | Canonical: https://flaviocopes.com/fix-uncaught-error-objects-are-not-valid-as-a-react-child/

This error might happen because you’ve got a [React](https://flaviocopes.com/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:

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

You should do this instead:

```javascript
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.
