Skip to content

Provide better error for: "Error: Objects are not valid as a React child (found: object with keys.." #9552

@rajaraodv

Description

@rajaraodv

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Currently if we by mistake pass a JS object to JSX instead of a string, then we get the following error:
"Error: Objects are not valid as a React child (found: object with keys.."

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).

What is the expected behavior?
Show a better error that helps solve the issue like in this SO solution.
http://stackoverflow.com/questions/36100702/invariant-violation-objects-are-not-valid-as-a-react-child-for-nested-objects
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions