How To A Create NavLink Component in NextJS

Make your own active link component with useRouter and TypeScript

Malcolm
Frontend Digest
Published in
3 min readApr 11, 2021

--

Photo by Ellie Lord on Unsplash

One of the first components I create while making a new NextJS application is a NavLink component. This component wraps Next's next/link component and adds an activeClassName if that link is active. If you’ve worked with React Router before, you are most likely familiar with their…

--

--