You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Suggestion]: Change the error message "Objects are not valid as a React child (found: object with keys {aaa, bbb}). If you meant to render a collection of children, use an array instead.
#6681
Open
FrancisVila opened this issue
Mar 6, 2024
· 0 comments
You get the error message above when you create a functional component and omit to surround the properties with curly braces {}.
The message should be more directive.
Page
No response
Details
I think everybody does this when they first create a component. Type the error in your search engine, and you will see thousands of people asking the same question. For the sake of argument I attempted to "use and array instead" and got even more mysterious messages.
I believe the error message should be more like (for a component called MyComponent ) :
MyComponent is a functional component, and as such groups together all properties from the JSX tag into a single object. To use those properties directly in the body of MyComponent , surround the list of properties with curly brackets, such as MyComponent({foo, bar}). For more information, read https://react.dev/learn/passing-props-to-a-component .
The text was updated successfully, but these errors were encountered:
Summary
You get the error message above when you create a functional component and omit to surround the properties with curly braces {}.
The message should be more directive.
Page
No response
Details
I think everybody does this when they first create a component. Type the error in your search engine, and you will see thousands of people asking the same question. For the sake of argument I attempted to "use and array instead" and got even more mysterious messages.
I believe the error message should be more like (for a component called MyComponent ) :
The text was updated successfully, but these errors were encountered: