Why having a Link as a child of a Button
I see examples in React with Radix that does things like:
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
<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.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?
If you're not going to use Radix styles then yeah, style the link as you want it styled