From 83ca1845ea055f03e7a80e208f312ef5e34baf3d Mon Sep 17 00:00:00 2001 From: kevinlog Date: Thu, 2 Jan 2020 13:04:29 -0500 Subject: [PATCH] use BrowserRouter component --- .../public/applications/endpoint/index.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx index 7cd6469c3e5bd8..865fc20d9e4385 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/index.tsx @@ -8,8 +8,7 @@ import * as React from 'react'; import ReactDOM from 'react-dom'; import { CoreStart, AppMountParameters } from 'kibana/public'; import { I18nProvider, FormattedMessage } from '@kbn/i18n/react'; -import { History, createBrowserHistory } from 'history'; -import { Route, Router, Switch } from 'react-router-dom'; +import { Route, BrowserRouter, Switch } from 'react-router-dom'; /** * This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle. @@ -17,8 +16,7 @@ import { Route, Router, Switch } from 'react-router-dom'; export function renderApp(coreStart: CoreStart, { appBasePath, element }: AppMountParameters) { coreStart.http.get('/api/endpoint/hello-world'); - const history = createBrowserHistory({ basename: appBasePath }); - ReactDOM.render(, element); + ReactDOM.render(, element); return () => { ReactDOM.unmountComponentAtNode(element); @@ -26,12 +24,12 @@ export function renderApp(coreStart: CoreStart, { appBasePath, element }: AppMou } interface RouterProps { - history: History; + basename: string; } -const AppRoot: React.FunctionComponent = React.memo(({ history }) => ( +const AppRoot: React.FunctionComponent = React.memo(({basename}) => ( - + = React.memo(({ history }) = )} /> - + ));