# Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `App`.

- **ID:** `react/invalid-array-child`
- **Domain:** react
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

A component's render method returned an array containing non-React-element objects, such as plain JavaScript objects or unrendered component classes, instead of valid React elements.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| React 16.8+ | active | — | — |
| React 17.0.2 | active | — | — |
| React 18.2.0 | active | — | — |

## Workarounds

1. **If you meant to render a list of components, ensure each item is a React element: data.map(item => <Component key={item.id} />). If you meant to display an object, use JSON.stringify(object) or access specific properties.** (90% success)
   ```
   If you meant to render a list of components, ensure each item is a React element: data.map(item => <Component key={item.id} />). If you meant to display an object, use JSON.stringify(object) or access specific properties.
   ```
2. **Check that you are not accidentally passing a component class instead of an instance: <Component /> not Component alone.** (85% success)
   ```
   Check that you are not accidentally passing a component class instead of an instance: <Component /> not Component alone.
   ```

## Dead Ends

- **Wrapping the object in a <div> or fragment** — If the object is not a valid React element, wrapping it won't fix the underlying issue—it will just produce a different error or render nothing. (40% fail)
- **Using JSON.stringify on the object** — This converts the object to a string, which may be displayed but is not a valid React child and can cause hydration mismatches. (60% fail)
- **Importing the component as default instead of named** — If the object is a plain JS object (e.g., from an API), no import style will make it a valid component. (50% fail)
