3 ms·
Why do I need a web component for a button? Also, if I have web components, why do I need React?
by ilaksh 5y ago
Why do I need a web component for a button?
Also, if I have web components, why do I need React?
- schwartzworld 5y agoYou might not need a web component for a button, but every component library includes them. You're probably not using default css, so it helps to limit your customization options to a few semantic props. In react you will be calling <Button> components, whether those are web components or react components doesn't take away from what react is great at: giving you a framework for declaring a reactive ui. Having the base components as web components makes them framework agnostic. maybe you don't need react.
- peteforde 5y agoMost applications do not need or benefit from React. There's many superior techniques which can provide similar outcomes using HTML generated by the server (gasp). React was like a long, painful specs gathering process. Going forward, I would never start a major project with React when simpler, standards-based approaches are now just as viable. The main reason people use web components for buttons is to provide a consistent API and DX, and to facilitate themes and code reuse.