Hi,
I'm rendering DateTimePickerComponent with a given value.
When my component updated with different value, the value on the control stays the same.
Please let me know what I'm doing wrong, sounds like very simple scenario to me.
Thanks,
Asaf
Code Example (example also available here - https://stackblitz.com/edit/react-7tziri )
import React, { Component } from "react";
import moment from "moment";
import { DateTimePickerComponent } from "@syncfusion/ej2-react-calendars";
import "@syncfusion/ej2/material.css";
export default function App() {
return (
<div>
<DateWrapper />
</div>
);
}
class DateWrapper extends Component {
constructor(params) {
super(params);
setInterval(() => {
this.setState({
date: moment(this.state.date)
.add(1, "days")
.toDate()
});
console.log("new date:" + this.state.date.toString());
}, 2000);
this.state = {
date: moment().toDate()
};
}
render() {
return <DateComponent date={this.state.date} />;
}
}
const DateComponent = ({ date }) => <DateTimePickerComponent value={date} />;