I want to update now indicator manually after some time interval but it doesn’t reflect its updated value. I am getting its updated value outside of the method but not reflecting on UI side.
I have implemented FullCalendar library in useMemo function in my react component and called it in html section. I have created one state variable defining now variable to display now indicator. Now I want to update its value manually.
const [now, setNow] = useState<Dayjs>(getNowTime());
useEffect(() => {
setTimeout(async () => {
const tempDate = now;
const updatedDate = dayjs.tz(tempDate?.toDate().setDate(tempDate.toDate().getDate() + 1));
setNow(updatedDate);
}, 2000);
}
}, []);
const fullCalendar = useMemo(() => {
return (
<FullCalendar nowIndicator={true} now={now.toISOString()}..../>) },[now]);
return <> {fullCalendar}</>
Even after updating after 2 seconds it doesn’t reflect its updated value in indicator.
Kesha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.