-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
36 lines (31 loc) · 1.38 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { useEffect, useState } from 'react';
import { Route, useLocation } from 'react-router';
import { Routes } from 'react-router-dom';
import Snowfall from 'react-snowfall';
import './App.css';
import Home from './Views/Home';
import { Participant } from './Models/Participant';
import Show from './Views/Show';
function App() {
const [participants, setParticipants] = useState<Participant[]>([]);
const [participant, setParticipant] = useState<Participant>(new Participant(-1, "", false, undefined));
const onParticipantsChange = (participants: Participant[]) => {
setParticipants(participants);
console.log(participants);
}
const onParticipantChange = (participant: Participant) => {
setParticipant(participant);
}
return (
<div className="App">
<header className="headerText">{document.title}</header>
<Snowfall snowflakeCount={1000} speed={[1.0, 1.0]} style={{ position: 'fixed' }} />
<Routes>
<Route path="/" element={<Home participants={participants} setParticipants={onParticipantsChange} participant={participant} setParticipant={onParticipantChange} />} />
<Route path="/home" element={<Home participants={participants} setParticipants={onParticipantsChange} participant={participant} setParticipant={onParticipantChange} />} />
<Route path="/show" element={<Show />} />
</Routes>
</div>
);
}
export default App;