I want to display the current date in my component. My code works in the console, but the React console says:
"bundle.js: 14744 Uncaught RangeError: maximum call stack size exceeded
My component is as follows:
import React from 'react';
var FontAwesome = require('react-fontawesome');
export class Date extends React.Component {
constructor() {
super();
var today = new Date(),
date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
this.state = {
date: date
};
}
render() {
return (
<div className='date'>
<FontAwesome name='calendar' />{this.state.date}
</div>
);
}
}
Yes, I know that I'm pretty new, but maybe someone can help me. I google for hours --.-
thanks alot!
source
share