add second page

This commit is contained in:
Hope87
2021-05-31 13:40:49 +03:00
parent 7464e823b8
commit 844cc7f9df
6 changed files with 48 additions and 921 deletions

View File

@ -1,4 +1,4 @@
import React, { Suspense, lazy } from 'react';
import React, { useState, Suspense, lazy } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import './fonts/stylesheet.css';
@ -8,7 +8,8 @@ const HomePage = lazy(() => import('./pages/HomePage'));
const CandidatePage = lazy(() => import('./pages/CandidatePage'));
const App = () => {
const isAuth = true;
const [isAuth, setIsAuth] = useState(false);
return (
<Router>
<Suspense fallback={<div>Loading...</div>}>
@ -16,10 +17,10 @@ const App = () => {
<Switch>
<Route path="/" exact component={HomePage} />
<Route path="/candidate/:id" component={CandidatePage} />
<Route compoent={<div>Not found page</div>} />
<Route component={<div>Not found page</div>} />
</Switch>
) : (
<Route path="/" exact component={AuthPage} />
<Route path="/" exact component={(props) => <AuthPage {...props} setAuth={setIsAuth} />} />
)}
</Suspense>
</Router>