React.js/React Router3 useLocation 1. 소개 useLocation은 React Router에서 제공하는 hook으로 현재 페이지의 URL 정보를 가져올 때 많이 쓰인다. useLocation v6.22.0 | React Router useLocation Type declarationdeclare function useLocation(): Location; interface Location extends Path { state: State; key: string; } interface Path { pathname: string; search: string; hash: string; } This hook returns the current location object. This can reactrouter.com 2. 꿀팁 import * .. 2024. 2. 7. 소개 React Router는 SPA 방식에서 URL에 따라 페이지를 렌더링 해주는 라이브러리다. Feature Overview v6.21.3 | React Router Feature Overview Client Side Routing React Router enables "client side routing". In traditional websites, the browser requests a document from a web server, downloads and evaluates CSS and JavaScript assets, and renders the HTML sent from the server. When reactrouter.com 설치 npm install react-router-dom ya.. 2024. 1. 31. useNavigate import { useNavigate } from "react-router-dom"; useNavigate는 URL로 다른 컴포넌트로 이동할 수 있다. Home 화면에서 Login 화면으로 이동 import { useNavigate } from "react-router-dom"; const Home = () => { const navigate = useNavigate(); const onClickMove = () => { navigate("/login"); } return ( 이동하기 ) } Home 화면에서 Login 화면으로 이동하면서 값 전달 (Home.js) import { useNavigate } from "react-router-dom"; const Home = () => { const na.. 2022. 8. 9. 이전 1 다음