import React from 'react' ; import ReactDOM from 'react-dom' ; import { Router } from 'react-router-dom' ; import { AppMountParameters } from 'opensearch-dashboards/public' ; import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public' ; import { VisualizeApp } from './app' ; import { VisualizeServices } from './types' ; import { addHelpMenuToAppChrome , addBadgeToAppChrome } from './utils' ; export const renderApp = ( { element , onAppLeave } , services ) => { addHelpMenuToAppChrome ( services . chrome , services . docLinks ) ; if ( ! services . visualizeCapabilities . save ) { addBadgeToAppChrome ( services . chrome ) ; } const app = ( < Router history = { services . history } > < OpenSearchDashboardsContextProvider services = { services } > < services . i18n . Context > < VisualizeApp onAppLeave = { onAppLeave } /> < /services.i18n.Context> < /OpenSearchDashboardsContextProvider> < /Router>); ReactDOM . render ( app , element ) ; return ( ) => ReactDOM . unmountComponentAtNode ( element ) ; } ;