Closed ruckerzerg closed 3 weeks ago
Hey @ruckerzerg , thank you for reporting the issue. We'll look into it and get back to you soon!
A workaround is to manually push the new route, but this is not very convenient...
const router = useRouter()
return (
<Link href="/hello/world">
<Button
size="md"
variant="solid"
action="primary"
onPress={e => {
e.preventDefault()
router.push(href)
}}
>
<ButtonText>Hello World!</ButtonText>
</Button>
</Link>
)
The best solution would be to have an optional CSS only Button. Then one could also use server components instead of relying on use client
.
hey @ruckerzerg @philippbosch @RobertSasak , you should be wraping link with the button ( swap parent with children) , then it will not break in the client side ie..,
<Button size="md" variant="solid" action="primary">
<Link href="/about">Go to about client ▶</Link>
</Button>
Closing this issue for now. Please feel free to open this issue again if had queries in this same context.
Description
Button component breaks cliend-side navigation when used in Next.js' Link component
gluestack-ui Version
2
Platform
Additional Information
On click it triggers a full page reload instead of handling it on the client side.