React 로그인로그아웃 기능 구현 강좌를 따라하다가
다음과 같은 오류를 만났다.
'useHistory' is not exported from 'react-router-dom'
구글링하여 찾아낸 해결법.
react-router-dom V6에서 useHistory()는 useNavigate()로 대체되어 Navigate로 변경했더니 잘 작동 된다!
**변경전
import {useHistory} from "react-router-dom"
const history = useHistory();
props.history.push("/login")
**변경후
import { useNavigate } from "react-router-dom"
const navigate = useNavigate();
navigate("/login")
React_Router에서 props 전달하기 (0) | 2021.11.22 |
---|---|
React_React Icons (0) | 2021.11.18 |
React_useReducer (0) | 2021.11.12 |
React_useMemo (0) | 2021.11.11 |
React_useEffect (0) | 2021.11.11 |
댓글 영역