반응형 v62 export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' react-router-dom v6에서 오류가 발생했다. // 소스 코드 import { useHistory } from "react-router-dom"; // 오류 발생 export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' // react-router-dom v5 import { useHistory } from "react-router-dom" const Profile = () => { const history = useHistory(); const onLogOutClick = () => { history.push("/"); } }; useHistory -> Navigate로 변경 // react-route.. 2022. 1. 24. export 'Redirect' (imported as 'Redirect') was not found in 'react-router-dom' export 'Redirect' (imported as 'Redirect') was not found in 'react-router-dom' react-router-dom v6 버전에서 Redirect가 사라지고 Navigate로 변경. // react-router-dom v5 import { HashRouter as Router, Redirect, Switch, Route } from "react-router-dom"; const AppRouter = ({ isLoggedIn }) => { return ( ); }; export default AppRouter; // react-router-dom v6 import { HashRouter as Router, Navigate, Routes, Route }.. 2022. 1. 24. 이전 1 다음 반응형