Why having a Link as a child of a Button

I see examples in React with Radix that does things like:
<Button asChild>
<Link href="/path">A Link</Link>
<Button>
<Button asChild>
<Link href="/path">A Link</Link>
<Button>
Why is this necessary? Wouldn't it be simpler to just use a Link and style it like a button? What am I missing?
3 Replies
Tenkes
Tenkes7mo ago
<Button /> is already styled component. To avoid writing styles again they wrapped Link in Button and used asChild prop which should use child's tag as tag in Button. So it wouldn't render button but actual link.
firstian
firstian7mo ago
So if I don't use a style component (e.g., straight Radix), then there is no point in using the Button at all, just style the link as I see fit directly?
Tenkes
Tenkes7mo ago
If you're not going to use Radix styles then yeah, style the link as you want it styled
Want results from more Discord servers?
Add your server