버전
1. react: 18.2.0
2. typescript
3. react-router-dom : 6.14.1
const PageNavWithHide = (): JSX.Element | null => {
const location = useLocation()
const hidePageNav = location.pathname === "/login" || location.pathname === "/signup"
if (hidePageNav) {
return null
}
return <PageNav />
}
login, signup일때 null을 리턴함 그외에는 PageNav컴포넌트를 리턴
잘 적용된 모습


728x90
버전
1. react: 18.2.0
2. typescript
3. react-router-dom : 6.14.1
const PageNavWithHide = (): JSX.Element | null => {
const location = useLocation()
const hidePageNav = location.pathname === "/login" || location.pathname === "/signup"
if (hidePageNav) {
return null
}
return <PageNav />
}
login, signup일때 null을 리턴함 그외에는 PageNav컴포넌트를 리턴
잘 적용된 모습


728x90