Router
-
React + TypeScript 기반 Router 설정하기Frontend/TypeScript 2021. 12. 30. 00:06
React + TypeScript 기반 프로젝트 생성 npx create-react-app [Project name] --template typescript ※ 아래와 같은 오류 발생 시 You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0). We no longer support global installation of Create React App. Please remove any global installs with one of the following commands: - npm uninstall -g create-react-app - yarn global remove create-react-app T..
-
React - JS로 라우팅 이동하기React/Router 2021. 6. 5. 20:15
Router의 Props history 객체 사용 go, push, replace 등등.. // App.js function App() { return ( ); } // Login.jsx import LoginButton from '../components/LoginButton'; export default function Login(props) { return ( Login 페이지 입니다. ); } // LoginButton.jsx export default function LoginButton(props) { const login = () => { setTimeout(() => { // 페이지 이동 props.history.push('/'); }, 1000); }; return 로그인하기; } 하지만..