390885 (23) [Avatar] Offline
#1
On page 47, there is such snippet
class DateTimeNow extends React.Component {
  render() {
    let dateTimeNow = new Date()
    return <span>Current date and time is {dateTimeNow}.</span>
  )
}
}


And I render this class to HTML and I got this error which states:
react.js:20150 Uncaught Invariant Violation: Objects are not valid as a React child (found: Wed Sep 07 2016 01:42:33 GMT+0800 (??????)). 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. Check the render method of `DateTimeNow`.

If I do some tiny modification like
let dateTimeNow = new Date().toLocaleString()

It works fine.
Azat Mardan (41) [Avatar] Offline
#2
It cannot be an object. I fixed it. Thanks!

---

Azat, author of React Quickly