07-17 Left Tab

골솔·2021년 7월 17일
0

ㅇㅇㅇㅈ 근로

목록 보기
14/15

😁 한 일

이 메뉴를 클릭하면 페이지에 맞게 주황색으로 바껴야했음

location 객체의 pathname 정보를 이용해서 ↓

const curPath = location.pathname

<Link to="/MyPage/MyContentsList">
	<p className={curPath=="/MyPage/MyContentsList"?"mypageleftinnerp-clicked":"mypageleftinnerp"}>내 콘텐츠 목록</p>
</Link>

일단 이렇게 구현해봤다.. 하위 페이지가 있을 경우는 ↓

<p className={curPath=="/MyPage/MyPageNotice"||curPath=="/MyPage/NoticeContent"?"mypageleftp-clicked":"mypageleftp"}>공지사항</p>

더 좋은 방법이 있을지도 모르겠다

> Router 참고

🤔 할 일

  • 컨텐츠 삭제할 때 팝업창 띄우기
profile
골때리는이솔

0개의 댓글