import{useCallback,useEffect,useRef,useState}from"react";export function useStateCallback(e){const[t,u]=useState(e),r=useRef(void 0),c=useCallback(((e,t)=>{r.current=t,u(e)}),[]);return useEffect((()=>{r.current&&(r.current(t),r.current=void 0)}),[t]),[t,c]}