11/* istanbul ignore file */
22import React , { useEffect } from 'react' ;
33import { Provider } from 'react-redux' ;
4- import { BrowserRouter as Router , Switch , Route , withRouter } from 'react-router-dom' ;
4+ import { BrowserRouter as Router , Routes , Route , useNavigation } from 'react-router-dom' ;
55import { ApolloProvider } from '@apollo/client/react' ;
66import * as codemirror from 'codemirror' ;
77import { PersistGate } from 'redux-persist/integration/react' ;
@@ -22,13 +22,6 @@ import { getLocaleMap } from '@generatedata/utils/lang';
2222import '~store/generator/generator.reducer' ;
2323import './styles/global.scss' ;
2424
25- // if (process.env.NODE_ENV === 'development') {
26- // const whyDidYouRender = require('@welldone-software/why-did-you-render');
27- // whyDidYouRender(React, {
28- // trackAllPureComponents: true,
29- // });
30- // }
31-
3225window . CodeMirror = codemirror ;
3326
3427const checkState = async ( state : any ) : Promise < any > => {
@@ -59,25 +52,29 @@ const LocalizationWrapper = (args: any) => {
5952 }
6053
6154 return (
62- < Switch >
55+ < Routes >
6356 { localizedRoutes . map ( ( { path, component : Component } , index ) => (
6457 < Route key = { index } path = { path } >
6558 < Component />
6659 </ Route >
6760 ) ) }
68- </ Switch >
61+ </ Routes >
6962 ) ;
7063} ;
7164
72- const App = withRouter ( ( { history } : any ) => {
65+ const App = ( ) => {
66+ const navigation = useNavigation ( ) ;
67+
7368 useEffect ( ( ) => {
74- initRouteListener ( history ) ;
69+ initRouteListener ( navigation ) ;
7570 } , [ ] ) ;
7671
7772 return (
7873 < ErrorBoundary >
7974 < Page >
80- < Route path = "/:lang?" > { LocalizationWrapper } </ Route >
75+ < Route path = "/:lang?" >
76+ < LocalizationWrapper />
77+ </ Route >
8178 < Toast />
8279 < SaveDataSetDialog />
8380 </ Page >
0 commit comments