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,6 +1,6 @@
|
||||
import { createStyles, makeStyles, Tab, Tabs, Theme } from '@material-ui/core'
|
||||
import { ReactElement } from 'react'
|
||||
import { useHistory } from 'react-router-dom'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { ROUTES } from '../../routes'
|
||||
|
||||
interface Props {
|
||||
@@ -24,10 +24,10 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
|
||||
export function FileNavigation({ active }: Props): ReactElement {
|
||||
const classes = useStyles()
|
||||
const history = useHistory()
|
||||
const navigate = useNavigate()
|
||||
|
||||
function onChange(event: React.ChangeEvent<Record<string, never>>, newValue: number) {
|
||||
history.push(newValue === 1 ? ROUTES.DOWNLOAD : ROUTES.UPLOAD)
|
||||
navigate(newValue === 1 ? ROUTES.DOWNLOAD : ROUTES.UPLOAD)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user