I am just rendering the data and display in between divs
but I am getting error this
Objects are not valid as a React child (found: Wed Dec 09 1998 00:00:00 GMT+0530 (India Standard Time)). If you meant to render a collection of children, use an array instead.
<Fragment key={String(index) + String(i)}>
<div>{displaytext}</div>
<div>{value}</div>
</Fragment>
Only issue is on this line <div>{value}</div>
if I remove this line everything works fine.If I add this line I am getting above error why ?
here is my code
https://codesandbox.io/s/ooj2wowy9q
React doesn't allow objects like Dates or Arrays as children, you need to convert value
to string, like this:
<div>{new Date(value).toString()}</div>
Hope this helps you!
value
is a date object. Try this:
<div>{moment(value).format('DD-MM-YYYY')}</div>
I think you might be using a date wrongly
<div>{value.toDateString()}</div>
might solve the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With