I want to output the current date in my componnent. In the console my code works, but the React console says:
"bundle.js:14744 Uncaught RangeError: Maximum call stack size exceeded"
My component looks like that:
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>
);
}
}
Yeah, I know I'm a pretty beginner, but maybe someone can help me. I googled for hours -.-
Thx alot!