import { useProcesses } from "contexts/process"; import type { Processes } from "contexts/process/types"; import { useEffect, useRef } from "react"; export const useProcessesRef = (): React.MutableRefObject => { const { processes } = useProcesses(); const processesRef = useRef({} as Processes); useEffect(() => { processesRef.current = processes; }, [processes]); return processesRef; };