-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
43 lines (37 loc) · 977 Bytes
/
index.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
37
38
39
40
41
42
43
import { BrowserRouter, Switch, Route } from 'react-router-dom'
import React, { FC, useEffect, useState } from 'react'
import { render } from 'react-dom'
import { timer } from 'rxjs'
import Home from '@/home'
import Props from '@/props'
import Count from '@/count'
import TodoList from '@/todoList'
const ReactProps: FC<{}> = () => {
const [count, setCount] = useState(0)
useEffect(() => {
const subscription = timer(0, 1000).subscribe(setCount)
return () => {
subscription.unsubscribe()
}
}, [])
return <Props count={count} />
}
const App: FC<{}> = () => (
<BrowserRouter>
<Switch>
<Route path="/" exact>
<Home />
</Route>
<Route path="/props" exact>
<ReactProps />
</Route>
<Route path="/count" exact>
<Count />
</Route>
<Route path="/todoList" exact>
<TodoList />
</Route>
</Switch>
</BrowserRouter>
)
render(<App />, document.getElementById('app'))