question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

createFragment warning when rendering a Date

See original GitHub issue
<p>{new Date()}</p>

Looks to be hitting the typeof object check.

Not sure if it should cast to string or toISOString or just error.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
glenjamincommented, Sep 10, 2015

One of our engineers was stuck on this for ages, as the error examples all show very different scenarios.

Perhaps include obj.toString() in the warning if it isn’t [object Object] or some similar heuristic?

Alternatively, what if the warning was for instanceof Object and everything else got coerced to a string?

0reactions
johann-sonntagbauercommented, Oct 14, 2015

@zpao thx for your answer. Tried to reproduce the problem in an simpler environment and the output looks exactly like yours. So my problem is related to some error in my components. Thx for your feedback

Read more comments on GitHub >

github_iconTop Results From Across the Web

When to use React createFragment? - Stack Overflow
Warning : Any use of a keyed object should be wrapped in React.addons.createFragment(object) before being passed as a child. // This array generates...
Read more >
API Reference - Roact Documentation
Make sure not to modify elements after they're passed into createFragment ! ... Warning. Using getValue inside a component's render method is dangerous!...
Read more >
Variable refers to new Date() can not be a child element. #7988
If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons....
Read more >
Fragments - React
A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding...
Read more >
uncaught error: objects are not valid as a react child (found
If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found