Lesson 153 of 1565 min readBy Deepak PaswanUpdated Oct 10, 2026
Concept lesson · explains an idea. Code is shown for reading, not run.
This is a lookup table. The messages below are the exact texts printed by React 19.3 (development build) when we triggered each mistake in the course playground, plus a few from Vite and Babel. Search the page for the start of your message.
Rendering errors
Message
Cause
Fix
Objects are not valid as a React child (found: object with keys {name}). If you meant to render a collection of children, use an array instead.
Each child in a list should have a unique “key” prop. (followed by “Check the render method of App.”)
A map returns elements without key
Add a stable key={item.id} to the outer element. Keys
Encountered two children with the same key, a. Keys should be unique so that components maintain their identity across updates.
Two siblings share a key
Use unique ids.
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.
A missing export, or import { X } for a default export (or the reverse)
Match export default with import X from and named exports with import { X } from. Importing and Exporting
X is not defined
A component or variable was used without importing or declaring it, or a typo
Import it or fix the spelling (components are case-sensitive).
Cannot read properties of undefined (reading ‘map’)
undefined.map(...): the data has not arrived or has another shape
Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn’t have a dependency array, or one of the dependencies changes on every render.
An effect sets state on every render
Add a correct dependency array, remove objects and functions created during render from it, or calculate the value instead. Effect Dependencies
Invalid hook call. Hooks can only be called inside of the body of a function component.
A hook was called outside a component or custom hook, in a class, or there are two copies of React
Call hooks at the top level of components and use... functions. Rules of Hooks
Rendered more hooks than during the previous render. (plus “React has detected a change in the order of Hooks called by App”)
A hook is called conditionally and the condition became true
Move the condition inside the hook, or into a child component.
Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
A hook is skipped by a condition or an early return
Call all hooks before any return.
Forms
Message
Cause
Fix
You provided a value prop to a form field without an onChange handler. This will render a read-only field. If the field should be mutable use defaultValue. Otherwise, set either onChange or readOnly.
A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen.
State started as undefined and later became a string
Start with useState("").
Compile-time (Babel in the playground, Vite in a project)
Message
Cause
Fix
Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
This site uses cookies that are needed for login, the shopping cart, checkout and security. Nothing else is loaded without your permission. Privacy Policy · Cookie Policy
Cookie preferences
NecessaryAlways on
Required for login and sessions, security and spam protection (including the verification check on tools), the shopping cart and checkout, tool downloads, and to remember this choice. These cannot be switched off.
This site does not currently use analytics or advertising cookies, so there is nothing optional to switch on.