44d443a048
* Initial work creating the Redis publishing and subscribing * Live view is working * Show the live reloading status on the page * Fixed some style issues on the run page with James * Fix for invalid JSX attributes in the ExitIcon svg * Some sexy shit * The end line is now correctly coloured * millisecondsToNanoseconds exported from core/v3 and imported correctly * Fix for e2e tests, we changed the h1 to an h2 * Tidied imports * Removed unused hook
14 lines
360 B
TypeScript
14 lines
360 B
TypeScript
import { useEffect, useLayoutEffect, useState } from "react";
|
|
|
|
export function useInitialDimensions(ref: React.RefObject<HTMLElement>) {
|
|
const [dimensions, setDimensions] = useState<DOMRectReadOnly | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (ref.current) {
|
|
setDimensions(ref.current.getBoundingClientRect());
|
|
}
|
|
}, [ref]);
|
|
|
|
return dimensions;
|
|
}
|