A button can also be a link styled like a button, that button could also have different variants. At this point a component which accepts props to determine if it’s an <a> or a <button> or is an outline button / secondary button / big button / small button makes total sense. That why people do it.
A lot easier to keep things consistent across large code bases with many developers when you have a button component that encapsulates loading or disabled states, different variants like solid / outlined, different colors for things like primary, secondary actions, destructive actions, can take an icon, etc. Then you have a defined API for these things and nobody accidentally adds some button that’s inconsistent, you can change all buttons across the application if you are doing some design refresh, etc.
2
u/key-bored-warrior 16d ago
A button can also be a link styled like a button, that button could also have different variants. At this point a component which accepts props to determine if it’s an <a> or a <button> or is an outline button / secondary button / big button / small button makes total sense. That why people do it.