import { startTransition, useState } from 'react'; const useLayoutState = ( ...args: Parameters> ): ReturnType> => { const [state, setState] = useState(...args); const setLayoutState: typeof setState = (...setStateArgs) => { startTransition(() => { setState(...setStateArgs); }); }; return [state, setLayoutState]; }; export default useLayoutState;