chore(deps): update react router from v5 to v6 (#280)
* chore(deps): update react router from v5 to v6 * fix: correctly choose navigate target if there is no history
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Box, createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
|
||||
import { ArrowBack } from '@material-ui/icons'
|
||||
import { ReactElement } from 'react'
|
||||
import { useHistory } from 'react-router-dom'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
interface Props {
|
||||
children: string
|
||||
@@ -20,10 +20,10 @@ const useStyles = makeStyles(() =>
|
||||
|
||||
export function HistoryHeader({ children }: Props): ReactElement {
|
||||
const classes = useStyles()
|
||||
const history = useHistory()
|
||||
const navigate = useNavigate()
|
||||
|
||||
function goBack() {
|
||||
history.goBack()
|
||||
navigate(-1)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user