Object as children does not show any error or warning
See original GitHub issueWhen an object is passed as children to be rendered there’s no warning or error and it doesn’t render anything. I’m not sure if the issue is related to preact or fresh.
Example code
const activities = [
{ id: "1", name: "Wake up", date: new Date() },
{ id: "2", name: "Eat breakfast", date: new Date() },
{ id: "3", name: "Go to work", date: new Date() },
{ id: "4", name: "Go to sleep", date: new Date() },
];
export default function Home() {
return (
<ul>
{activities.map((activity) => (
<li key={activity.id}>{activity}</li>
))}
</ul>
);
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Resolving Error: "Objects are not valid as a React child"
The “Objects are not valid as a React child” error might mean that a few different things are going wrong. ⚠️ Potential issues:...
Read more >Understanding the "Objects are not valid as a react child" Error ...
The "Objects are not valid as a React child" error happens when trying to render a collection of data by mistakenly returning the...
Read more >Invariant Violation: Objects are not valid as a React child
This error usually happens because a function involved in dispatching an event has been given an unexpected object type (i.e passing an object...
Read more >Object spreads with nested children gives unwanted key error.
I believe the following case should not result with a key error. So I would like to know if this is correct behaviour...
Read more >Handling the 'Object Does Not Exist' Error - SmartBear Support
The “Object Does Not Exist” message indicates that the tested application differs from the state it had during test recording or test creation....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The rendering inconsistency is a bug in preact-render-to-string. See https://github.com/preactjs/preact-render-to-string/issues/245 for that issue.
#761 will fix this being silently ignored. Instead an error will be thrown / warning logged in the future.
@lucacasonato this should be published as part of preact-render-to-string 5.2.5