#Button/Anchor as Next.js Link Component Bug

10 messages · Page 1 of 1 (latest)

harsh sapphire
#

When using a Button as a "Link" component in Next.js, the page changes but the page does not scroll back to the top. Seems to be the case for any Mantine component using the Next.js Link component, such as Anchors.

Is there a known fix for this or is it a bug?

#

Button/Anchor as Next.js Link Component Bug

dark holly
harsh sapphire
#

I am using the Mantine Button and Anchor components specifically.

#

Oh, yo umean without using the next.js Link component?

#

It works fine with an "a" component:
<Button component='a'...>

#

But the point is to use Link for next.js prefetching:
<Button component={Link}...>

harsh sapphire
#

Disregard, this is expected Next.js behavior. I need to pass in a parameter to Link to prevent it. Instead of passing ={Link}, can I pass ={<Link />} so I can pass it parameters? Or do I need to make a custom component?

dark holly
harsh sapphire