Skip to content

Commit ee6c8e2

Browse files
committed
Refactor Title component
1 parent b7fdea2 commit ee6c8e2

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

app/js/components/Title.jsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,23 @@ import { isEmpty } from 'lodash'
55
import Sectors from './badges/Sectors'
66
import SimulationRounds from './badges/SimulationRounds'
77

8-
const useTitle = (title) => {
8+
const Title = () => {
9+
const config = useSelector((store) => store.config)
10+
911
useEffect(() => {
1012
const prevTitle = document.title
13+
const title = isEmpty(config.sectors) ? (
14+
`${config.simulation_round} protocol`
15+
) : (
16+
`${config.simulation_round} protocol for ${config.sectors.join(', ')}`
17+
)
18+
1119
document.title = title
1220

1321
return () => {
1422
document.title = prevTitle
1523
}
1624
})
17-
}
18-
19-
const Title = () => {
20-
const config = useSelector((store) => store.config)
21-
22-
useTitle(
23-
isEmpty(config.sectors) ? (
24-
`${config.simulation_round} protocol`
25-
) : (
26-
`${config.simulation_round} protocol for ${config.sectors.join(', ')}`
27-
)
28-
)
2925

3026
return (
3127
<div className="title">

0 commit comments

Comments
 (0)