import React , { useEffect , useRef } from 'react' ; import { render , unmountComponentAtNode } from 'react-dom' ; import { I18nProvider } from '@kbn/i18n-react' ; import { MountPoint } from '../types' ; const defaultWrapperClass = 'kbnMountWrapper' ; /**
 * MountWrapper is a react component to mount a  MountPoint inside a react tree.
  export const MountWrapper = ( { mount , className = defaultWrapperClass , } ) => { const element = useRef ( null ) ; useEffect ( ( ) => mount ( element . current ! ) , [ mount ] ) ; return < div className = { className } ref = { element } / > ; } ; param node export const mountReactNode = ( node ) : MountPoint => ( element ) => { render ( < I18nProvider > { node } < /I18nProvider>, element); return ( ) => unmountComponentAtNode ( element ) ; } ;