1
我试图使这个渲染:阵营 - 与moment.js
<p>Some date: {moment('12-25-1995', 'MM-DD-YYYY')}</p>
,并得到错误
Uncaught Invariant Violation: Objects are not valid as a React child (found: Mon Dec 25 1995 00:00:00 GMT+0100). 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 `MeetingComponent`.
我认为这是一种常见的试图输出对象时作出反应的响应。
对此,最佳实践解决方案是什么?
太好了,谢谢你的努力! –
很好的答案,但值得注意的是,实际上有几个重载的构造函数,除了你在这里提到的,还有严格的模式和语言环境。 http://momentjs.com/docs/#/parsing/ –