Answers for "Objects are not valid as a React child (found: Sun Mar 06 2022 14:35:38 GMT+0100 (West Africa Standard Time))"

1

Objects are not valid as a React child (found: Sun Mar 06 2022 14:35:38 GMT+0100 (West Africa Standard Time))

// Date is by default an Object, and objects can be react children, so
// Convert your date to string and it would work. Like this:
<div>{new Date(value).toString()}</div>


/*      OR      */
// Or you could use momentjs, a react library
npm install moment --save // run this in your react-app folder in the terminal

import moment from 'moment'; // Import it into your file
moment().format("MMM Do YY"); // for current date
moment("12-25-1995").format("MMM Do YY"); // for custom date
Posted by: Guest on March-06-2022

Code answers related to "Objects are not valid as a React child (found: Sun Mar 06 2022 14:35:38 GMT+0100 (West Africa Standard Time))"

Code answers related to "Javascript"

Browse Popular Code Answers by Language