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