Tengo un problema. Cuando le pregunté al backend cada 1 minuto, usó mi estado de inicio. Por ejemplo, cambié y seleccioné la fecha de inicio el 22.10.2021. Usó mi fecha de inicio el 22.11.2021. .2021) este es exactamente mi problema
mi código
const [startDate, setStartDate] = useState(new Date()); useEffect(() => { const interval = setInterval(() => { //this is important line console.log(startDate); //startDate = DateNow i want 10.22.2021 SetRaport(); }, 6000); return () => { clearInterval(interval); }; }, []); }, []); return( <StyledDatePicker selected={startDate} onChange={(date) => setStartDate(date)} /> <Paragraph onClick={() => SetRaport()} style={{ fontWeight: 600 }}>SYNCHRONIZE</Paragraph> )