Disclaimer I am no longer at RedHat and do not make decisions on the direction of PatternFly. Below are only my opinions on web components and how they will impact PatternFly.
Here are my two cents on web components. They are great for making embeddable widgets on website. A good example of this would be OpenTable’s reservation widget. It is currently an iframe. A web component would be great for that.
When it actually comes to building complex applications you will likely not use web components directly. Odds are a framework will be needed, or desired really. At that point why web components over something like Angular or React?
I am biased towards React so I will speak to why I choose it over web components every time.
- The declarative API. Working in a declarative environment is so much easier to reason about, at least for me, than an imperative one.
- State Management. This is built into React. Web Components doesn’t really have something for this built in. Again you could use a library of framework, but at that point what is the benefit?
- Tooling. Testing React applications is way easier than ones using web components. I don’t need a browser and I can choose how much of the tree I really need to render.
- Type Safety. Web-components (unless you use JSX) use regular HTML for rendering, etc. It is much harder to hook TypeScript into this type of flow. React works really well with TypeScript and it can make a huge difference on large projects.
- Community. The React community is huge and has many of the best minds on front-end behind it.
- Recruiting. Recruiting candidates is much easier when you say you are using React, GraphQL, etc. People like it and want to work with it.
- SSR. Server Side rendering is not needed for all apps, or most apps for the most part, but it is nice to have that ability. Especially when it comes to static site generation using tools like Gatsby or Next.
- Cross Platform APIs. React has the same APIs for React Native and react-dom. This is great since I “learn once, write anywhere”. React Native is not a web view like the other write once run anywhere libs. So you are going to get a bunch better experience with that.
Don’t get me wrong. I fully believe Web Components have a place at the table, but for applications I will always reach for React or the next framework that offers a robust declarative api that is easy to make type-safe with a good amount of tooling built around it. That may be a framework that renders to Web Components in the future, but for now it is not.
As for PatternFly going the route of Web Components I believe that many within the UXD team would love to see that happen. I do know many, not all, of Red Hat’s product UI’s (the ones using PatternFly 4) are using React though, and by the looks of it IBM is mainly using React too based on their Carbon Design System. It is not easy to build wrappers around Web Components with React (imperative vs declarative). I do not believe Web Components would not be successful for PatternFly 4. That does not mean it will not move that direction though so you might take my info with a grain of salt.