Why React threatens Web Components’ Future
The first time I read about Google’s Polymer, I got addicted to it. I am a “seasoned” Vaadin programmer and although I am not fond of interface programming, I can tolerate component oriented development.
That is what I expect, from Web Components in general, and Polymer in particular: to provide me out of the box components which can improve my interface development experience. Polymer promised me a better future, it promised me that whatever I need to do “There is a component for that”.
And then comes Facebook’s React..
Some months later I am using React for web development and I suppose it will be my main tool for frontend for a while.
You say potato, I say potato
Technically React and Polymer have two different goals. React aims to be a library to build interfaces and Polymer is an API to build elements. But in reality, react interfaces are built through component composition, and you can use this technique with Polymer to build whole interfaces. They may have different goals, but the reality is that they are interchangeable.
Since both frameworks overlap and can mostly cover the same requirements, when developing an application you may end up having to chose one of them. According to the 2016 Stack Overflow Survey React achieved 7th on the most loved technologies and Polymer is not even seen on the ranks. This implies that most people will probably chose React over Polymer.
Why we should care who “wins”
Polymer is supposed to be a thin layer which enables the creation of web components, but the web components per si are supposed to be a standard which will be able to run in any browser and technology in the future. We can start using any polymer component today without learning polymer just just by importing the component and using it in our markup.
Cross cutting components (e.g auto-complete box, select box, etc) should be developed using cross cutting technologies such as Polymer, enabling more people to use them regardless of their technology preference(React, Angular, Vanilla HTML), this way, everybody in the software development community wins.
What Threatens the future
Based on Github stars, the react community is around 3 times larger than Polymer’s (57k vs 17k).
Of course people developing react applications are focused on developing react components instead of Web Components. What really threatens the Web Components future is the fact that there are a lot of cross-cutting components being built with react instead of polymer.
Yes, react is aimed to software development, not component development, but lots of components are being created and shared. If people keep pushing the development of react components instead of Polymer components, React will monopolize the components “market”, and when all the Web Component features are standardized and implemented on the main browsers, it may have been an effort waste. A component building standard is only worth it if there are components to be used.
Other problem is the community effort waste. Cross-cutting components are being made to suit each library, such as Angular, not only React. Focusing on developing technology agnostic components would lead to better components available for all developers.
My Wish For the Future
I want the future that Web Components promised me. I want to be able to create a web page and have an “element for that” available without effort. But for that we need a community mindset change to focus on Web Components instead of react specific components.
But for that we need an API as strong as the one given by React or else people (just like me) will keep pushing React components development.
Unfortunately, the future does not seem bright.