re: JavaScript predictions for 2019 by npm VIEW POST

FULL DISCUSSION
 

Sounds like a lot more of 2018 to me.

React sure does enjoy a lot of hype, but according to one recruiter I recently spoke to React only accounts for 7% of job requests flowing through their agency. Survey results, number of Github stars and npm downloads are not great metrics, especially when large corporations can host local npm registries. Does this graph include the downloads in various instances of Artifactory or other local npm registries? It is only a matter of time before React goes the way of the Do Do like other JavaScript libraries before it. The main reasons will most likely be resistance to change and failure to adopt web spec.

IMHO 2019 is the year of Web Components, as Microsoft Edge will be the last evergreen browser to adopt the Custom Elements v1 spec. Web Components largely make UI libraries based on component patterns obsolete, with the exception of how libraries like React make components stateful of course.

Why should a team in 2019 considering how to build UI components use React when a huge chunk of the API for developing a component is baked into the browser with Custom Elements v1? I recently built a micro library that makes Web Components stateful and the entire library bundles down to under 2.3Kb minified.

 

Because I can do SSR with React. Single codebase for both backend and frontend.

 

You can SSR Web Components too and still retain isomorphic JavaScript, hell you could use TypeScript on the front end and back end too.

My use of React is because of two things:

  • React Hooks for logic.
  • React Suspense for data fetching.

How do Web Components support these patterns ?

This isn’t a referendum against your use of React. Use whatever library suits the project but be aware JavaScript libraries come and go but W3C spec tends to stick around. Div still going strong after all these years!

But to answer your questions, Custom Elements still have lifecycle hooks and well fetch API is available in evergreen browsers.

 

How do you import your library into your web component? By leveraging webpack?

 

What exactly do you mean? If the library is distributed as esm, you would just import the methods you need with import. If the library is distributed as commonjs, you require them. A bundler like Webpack, Rollup, Parcel, or SystemJS would be needed to bundle everything together just like any other JavaScript project.

 

"one recruiter I recently spoke to React only accounts for 7% of job requests flowing through their agency."

Tech stacks can cluster around particular hubs in different cities and countries. I'm in a MERN stack hub here, but in other places you might look at the local market and realise it's all LAMP or the front-end is vanilla JS and jQuery. Had a company present at my bootcamp who used Backbone with no plans to migrate away.

Trends change from place to place.

code of conduct - report abuse