I would recommend handling the logic directly in the onEventResizing
event handler.
The typical action would be to notify the server or to ask for a confirmation. These actions are not typical “state changes” where useEffect
makes most sense.
If you want to trigger useEffect
you would have to change a state property. It could look like this:
const [eventResizeArgs, setEventResizeArgs] = useState(null);
useEffect(() => {
if (eventResizeArgs !== null) {
// ... process the event
}
}, [eventResizeArgs]);
const handleEventResize = useCallback(args => {
setEventResizeArgs(args);
}, []);
// ...
<DayPilotScheduler
onEventResize={handleEventResize}
// ...
/>