Skip to content

Commit 7dfe0b8

Browse files
committed
Replace useRouter
1 parent 2b9ec37 commit 7dfe0b8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/containers/base/HeaderContainer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { getScrollTop } from '../../lib/utils';
44
import { RootState } from '../../modules';
55
import { useSelector, useDispatch } from 'react-redux';
66
import { showAuthModal } from '../../modules/core';
7-
import { useRouteMatch } from 'react-router';
8-
import useRouter from 'use-react-router';
7+
import { useLocation } from 'react-router';
98

109
const { useEffect, useRef, useCallback } = React;
1110

@@ -56,8 +55,8 @@ function reducer(state: FloatingState, action: Action) {
5655
}
5756

5857
const HeaderContainer: React.FC<HeaderContainerProps> = () => {
59-
const router = useRouter();
60-
const isSearch = router.match.path === '/search';
58+
const location = useLocation();
59+
const isSearch = location.pathname === '/search';
6160

6261
const { user, custom, userLogo, velogUsername } = useSelector(
6362
(state: RootState) => ({

src/containers/write/PublishActionButtonsContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ import {
1212
import { pick } from 'ramda';
1313
import { escapeForUrl, safe } from '../../lib/utils';
1414
import { useMutation } from '@apollo/react-hooks';
15-
import useRouter from 'use-react-router';
15+
1616
import { setHeadingId } from '../../lib/heading';
17+
import { useHistory } from 'react-router';
1718

1819
type PublishActionButtonsContainerProps = {};
1920

2021
const PublishActionButtonsContainer: React.FC<
2122
PublishActionButtonsContainerProps
2223
> = () => {
23-
const { history } = useRouter();
24+
const history = useHistory();
2425

2526
const options = useSelector((state: RootState) =>
2627
pick(

0 commit comments

Comments
 (0)