Add active className in hooks example!!!

Seonmi Choi·2021년 10월 5일
0

Start again!!!

목록 보기
29/40
post-custom-banner
const Nav = () =>{
  const [activeClass, setClass] = useState('');

  return (
    <div className="nav-menu">
      <ul>
        <li> <Link onClick={() => setClass('active')} className={activeClass} to="/"> Home </Link> </li>
        <li> <Link to="/about"> About </Link> </li>
        <li> <Link to="/form"> Form </Link> </li>
      </ul>
    </div>
  )
}
profile
I am not afraid of learning!

0개의 댓글