import React, { useEffect, FC } from 'react'; import { Route, Switch } from 'react-router-dom'; import NotFound from './common/NotFound'; import { ServersMap } from './servers/data'; import './App.scss'; interface AppProps { fetchServers: Function; servers: ServersMap; } const App = ( MainHeader: FC, Home: FC, MenuLayout: FC, CreateServer: FC, EditServer: FC, Settings: FC, ShlinkVersions: FC, ) => ({ fetchServers, servers }: AppProps) => { // On first load, try to fetch the remote servers if the list is empty useEffect(() => { if (Object.keys(servers).length === 0) { fetchServers(); } }, []); return (
); }; export default App;