Next.js Discord

Discord Forum

Is it a must to use `useEffect`whenever I want to use `usePathname`?

Unanswered
African Slender-snouted Crocodil… posted this in #help-forum
Open in Discord
Original message was deleted.

3 Replies

Bengal
It may help to know what you’re trying to do. usePathname is a client component hook, and I think that example is suggesting making an async call, which in client components can be done with useEffect. If you just want to do some local processing with the pathname you can do that without useEffect
Bengal
Yeah, I think you can just search through that for your metadata object without using useEffect
Unless that list gets really massive it shouldn’t be a problem