Link component does not redirect
Unanswered
Schweizer Laufhund posted this in #help-forum
Schweizer LaufhundOP
Something odd is happening, I'm assuming it's because of the way Next renders things.
(Using app router). So I have this component with a <Link> and when I click it it's supposed to redirect me to a dynamically generated route. However, when I have
(Using app router). So I have this component with a <Link> and when I click it it's supposed to redirect me to a dynamically generated route. However, when I have
use client
in my dynamic route file clicking the link component does nothing, only when I add remove "use client" does the page automatically send me to the right url. The reason why my dynamically generated route is a client component is because i want have onClick
enabled3 Replies
Schweizer LaufhundOP
Ok I think i found the reason why, fetching the data in my client component was causing it
Schweizer LaufhundOP
does anyone know how to fetch data in a dynamic route when its a client component?
Brown bear
My best guess is you need to make the fetch call inside of a useEffect hook.