import React from 'react'; import { Switch, Route, useLocation } from 'react-router-dom'; import { Location } from 'history'; import PollCreation from '../PollCreation/PollCreation'; const Profile = React.lazy(() => import('../Profile/Profile')); const Feed = React.lazy(() => import('../Feed/Feed')); const Login = React.lazy(() => import('../Login/Login')); const Registration = React.lazy(() => import('../Registration/Registration')); const Home = React.lazy(() => import('../Home/Home')); const Notifications = React.lazy(() => import('../Notifications/Notifications')); export interface LocationState { background: Location; } const Router: React.FC = React.memo(() => { const location = useLocation(); const background = location.state && location.state.background; const ModalSwitch = ( ); return ( <> {ModalSwitch} ); }); export default Router;