I think I just found a way like the codes below:
const Form = () => {
const [dpg, setDpg] = React.useState(new DayPilot.Gantt("dp"));
React.useEffect(() => {
dpg.init();
}
const updateGantt = () => {
axios.post('./src/GanttChart/getData/ganttData.php', {
jobNumber: jobNumber,
})
.then(function (response) {
console.log(response.data);
dpg.startDate = "2023-01-01";
dpg.days = 30;
dpg.tasks.list = [
{ id: 1, start: "2023-01-05T00:00:00", end: "2023-01-10T15:00:00", text: jobNumber }
];
dpg.update();
})
.catch(function (error) {
console.log(error);
});
}
}
Lol, Nice! I can continue now!