zucchetti-sa5/themes/onepirate/modules/form/defer.tsx

16 lines
333 B
TypeScript
Raw Normal View History

2022-10-28 11:41:58 +02:00
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;
}