From a4ccb298804d79ae31e6e06908ffcdcb78449e6a Mon Sep 17 00:00:00 2001 From: Enya <26k1234o3@gmail.com> Date: Sat, 9 Dec 2023 15:55:40 +0800 Subject: [PATCH] change useNavigate to useHistory --- packages/frontend/js/components/RoomList.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frontend/js/components/RoomList.tsx b/packages/frontend/js/components/RoomList.tsx index 0a774934..6c9a77f2 100644 --- a/packages/frontend/js/components/RoomList.tsx +++ b/packages/frontend/js/components/RoomList.tsx @@ -8,7 +8,7 @@ import { getRoomList } from '../redux/slice/roomSlice' import Modal from './Modal' import ErrorModal from './ErrorModal' -import { useNavigate } from 'react-router-dom' +import { useHistory } from 'react-router-dom' import { createRoom } from '../api' type obj = { @@ -87,7 +87,7 @@ const RoomList: React.FC = () => { }) } - const navigate = useNavigate() + const history = useHistory() const [isErrorVisible, setIsErrorVisible] = useState(false) const [errorText, setErrorText] = useState('') @@ -100,7 +100,7 @@ const RoomList: React.FC = () => { // @ts-ignore const roomID = res.room.roomId - navigate(`/game/${roomID}`) + history.push(`/game/${roomID}`) } }) .catch((err) => {