zucchetti-sa5/themes/onepirate/modules/form/defer.tsx
Arnaud Fauconnet 328a760eb8 added theme
2022-10-28 11:41:58 +02:00

16 lines
333 B
TypeScript

import * as React from 'react';
export default function defer<P>(Component: React.ComponentType<P>) {
function Defer(props: P) {
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => {
setMounted(true);
}, []);
return <Component mounted={mounted} {...props} />;
}
return Defer;
}