import React , { useEffect } from 'react' ; import { Router , Switch , Route , Redirect } from 'react-router-dom' ; import { ScopedHistory } from 'kibana/public' ; import { METRIC_TYPE } from '@kbn/analytics' ; import { UIM_APP_LOAD } from './constants' ; import { EditPolicy } from './sections/edit_policy' ; import { PolicyList } from './sections/policy_list' ; import { trackUiMetric } from './services/ui_metric' ; import { ROUTES } from './services/navigation' ; export const App = ( { history } ) => { useEffect ( ( ) => trackUiMetric ( METRIC_TYPE . LOADED , UIM_APP_LOAD ) , [ ] ) ; return ( < Router history = { history } > < Switch > < Redirect exact from = "/" to = { ROUTES . list } / > < Route exact path = { ROUTES . list } component = { PolicyList } / > < Route path = { ROUTES . edit } component = { EditPolicy } / > < /Switch> < /Router>); } ;