Where JavaScript is headed in 2022

Since 2016 the State of JavaScript survey has undertaken the monumental task of querying the JS multitudes about the multifarious frameworks, techniques, and features that they use to build applications. The latest incarnation of this Herculean effort occurred in the spring of 2022, and the results are now available. These results offer a gold mine of interesting data on the JavaScript space. Here are some of the key highlights and takeaways.

What comes after React?

Frameworks—front-end, back-end, and full-stack—have been a wildly active area for JavaScript over the last few years. This has settled out to some extent, but there are still quite a few new projects entering the space.

On the front end, React is still the leader, ranked #1 in use and awareness. However, React is only #4 for interest and #3 for retention. Which front-end frameworks enjoy the highest interest and retention? Those would be Svelte and Solid, respectively. This marks a slight shift from last year, when Svelte held #1 in both categories. Svelte and Solid are vying for the title of upstart developer favorite.

Angular is showing ominous signs of weakness around retention and interest, ranking near the bottom at #9. Nevertheless, it remains #2 for current usage, and #3 for awareness. Vue continues to be a strong contender, with a decent ranking across all categories.

Overall the story on the front end is of incremental refinements, rather than revolutionary upheaval.

And on the back end? Next.js instigated the full-stack JavaScript movement, and remains second only to Express in both awareness and usage. The comparison of Next to Express is of course imperfect. Express is a server-side framework only, the worker of Node-based HTTP. Next is a different animal entirely, allowing for the building and wiring together of client and server.

On developer interest and retention, SvelteKit led the field, taking #1 in both categories. On interest, newcomers Remix and Astro earned the #2 and #3 places. Gatsby, the static site generator, still holds a high rank of #3 in awareness and use, but has declined to position #13 in both interest and retention.

In similar style to Vue itself, the full-stack framework for Vue, Nuxt, registered a respectable #4 in awareness and use, and a ranking of #9 for interest and retention. Astro, in addition to ranking #3 in retention, ranked #2 in interest. The Fastify framework ranked #3 in retention.

Unstoppable TypeScript and tsc

One of the strongest trends is the continuing growth of TypeScript along with the greater awareness and use of its command line compiler, tsc. TypeScript has gone from an interesting idea to a standard over the last few years. More than 11,000 people responded to the question of JavaScript flavors, with 98.6% of respondents identifying TypeScript as the technology they use when compiling from something else to JavaScript.

That leaves about 6,000 survey takers, or about 30% who didn’t respond to that question, presumably those using vanilla JavaScript. Certainly, some significant percentage of developers who use TypeScript also still use plain JavaScript. Still, the takeaway from this question is that 69% of respondents are using TypeScript in some form, to some degree.

The rise of tsc as a build tool (ie for compiling TypeScript to JavaScript via a tsconfig.json file) is graphically represented in the popularity/satisfaction quadrant, which shows that tsc as a rising star on both counts.

Elm by popular demand

Another interesting discovery in relation to languages ​​that compile to JavaScript is the popularity of Elm. Elm is an ingenious functional language geared for web development, and highly regarded for its enablement of fast and fluent applications. But it’s also a mothballed project without any commits for months. The takeaway? Clearly the basic ideas in Elm are still desirable and popular. Perhaps a new leader could take up the project and carry it forward to the benefit of the entire ecosystem.

The promise of Elm is underscored by its winning the Most Write-Ins award. Even when Elm wasn’t an explicit choice among the answers to questions in the survey, users love it so much that they wrote it in.

Nullish coalescing coalesces

JavaScript developers really like nullish coalescing and optional chaining. It’s not hard to see why. Both features make a repetitive necessity simpler and more concise, handling nulls precisely in value settings and avoiding null pointer exceptions in chained property references, respectively. (More on both features can be found here.) Dynamic imports have also grown to become a well-known feature, although not as widely used. That is understandable, since lazy loading modules is not nearly as common a need. (More on dynamic imports here.)

Shadow DOM and Lit

On the browser API side, WebSockets are both well known and widely used, with nearly 70% of developers who know about them saying they have used them. Shadow DOM has a similar footprint, with around 70% being aware of the feature, and nearly 66% of those aware having used it. Shadow DOM is an especially interesting feature as it represents the frontier between frameworks like React, the W3C standards, and browser implementations.

Speaking of the Shadow DOM, the Lit framework, built explicitly upon the foundation of the browser shadow DOM and the web component spec, is showing a modest rise out of obscurity from 2020 until the survey date.

Test with Jest

One of the rising stars of the JS ecosystem is the Jest testing framework. Jest was one the most positively received technologies in the 2020 survey, and the latest survey shows it ebbing only slightly on that front, while the number of developers using it has risen.

Jest is built into the create-react-app tool, and it’s the basis for other React testing tools. This drives much of its adoption, but while React’s popularity has leveled off, Jest’s has continued to grow. This is because Jest is not limited to React and is finding popularity in use with a range of other frameworks, as well as vanilla JavaScript and TypeScript.

The battle of the build tools

Webpack has been the de facto king of JavaScript build pipelines, and the current survey reflects that. However, it also reveals that, while the number of developers using Webpack appears to have held steady, more developers are reporting dissatisfaction with it. One factor in this dissatisfaction may be expectations: the simple fact that as more people use any popular tool, and as more people are required to use it because it has become standard, the more it tends to come under fire as a tool that should work flawlessly.

But a bigger factor in Webpack’s declining satisfaction may be the entry of Vite into the space. A flashy new approach to building JavaScript apps, Vite is intended to address some of Webpack’s shortcomings. It seems to be doing a good job, as high profile projects like SvelteKit have adopted it, and Vite actually wins the State of JS best retention award for this year.

Snowpack, Rollup, and Parcel are also nibbling away at Webpack’s mindshare, but the most dramatic uptick in awareness and would-use-again-ness is esbuild (learn more about esbuild here). Another upstart contender is SWC, which is also showing sharp growth in interest among developers.

Where JS developers come from

No surprise that the United States is home to the lion’s share of developers on the globe. But can you guess which nation comes in second? If you guessed Germany, you’d be right, with 6.6% of respondents indicating they are from there. Deutschland is closely followed by Russia with a 6.2% share, and France and the UK with 5.7% and 5.4% respectively. Surprisingly, China represents only 1.6% of respondents.

Perhaps the greatest takeaway here is the increasingly global nature of JavaScript and software development in general. Certainly this is something to be celebrated. There is a wonderfully international distribution of coders out there from Nepal to Nigeria, and, astonishingly, a lone JS coder reporting in from Antarctica.

A lot happened in JavaScript

As the survey author, Sacha Greif, acknowledged, “the survey can ever only represent a tiny, tiny part of the JavaScript ecosystem.” Moreover, the open format of the survey is susceptible to promotion among the covered projects, or even outright gaming. Rather than a hard and fast ranking, the results should be seen as general trends.

The State of JavaScript survey was created to identify trends in the web development ecosystem with the goal of helping to inform developers’ choices, and it does seem to accomplish that end. Perhaps even more usefully, the survey serves as a great way to tune into interesting technologies and projects that you might otherwise miss entirely.

It certainly makes for interesting reading. Here’s hoping that Sacha Greif and his team him will continue their heroic efforts next year—and for many years to come.

Copyright © 2022 IDG Communications, Inc.

Leave a Comment

%d bloggers like this: