import React from 'react' ; function useStaticContent ( ) { const ref = React . useRef < any > ( null ) ; const [ render , setRender ] = React . useState ( typeof window === 'undefined' ) ; React . useEffect ( ( ) => { const isEmpty = ref . current . innerHTML === '' ; if ( isEmpty ) { setRender ( true ) ; } } , [ ] ) ; return [ render , ref ] ; } export interface StaticContentProps { as ? : keyof React . ReactHTML ; } export const StaticContent = ( { children , as = 'div' , ... props } ) => { const [ render , ref ] = useStaticContent ( ) ; if ( render ) { return React . createElement ( as , { ... props , children } ) ; } return React . createElement ( as , { ... props , ref , suppressHydrationWarning : true , dangerouslySetInnerHTML : { __html : '' } } ) ; } ;