State of JavaScript 2022
2022.stateofjs.com
2022.stateofjs.com
These things won: React, Webpack, Jest. They've been the dominant tools for years. (Typescript is getting there.) The ecosystem around them is enormous; a million edge cases have already been handled; they're not going anywhere for a long time.
It's not really a surprise that as browsers become more like operating systems, people will experiment and find new ways to leverage the available capabilities, but you don't have to play with the new toys, and you definitely don't have to use them for paying work. Just say "risk" ten times if anyone suggests them, and your PM will end up agreeing with you.
Sounds like everything that came before them, but they got a foothold somehow.
>Just say "risk" ten times if anyone suggests them, and your PM will end up agreeing with you.
Please don't overuse this, if you get in your groove then ten years down the line you'll end up being a naysayer to something the company actually should adopt.
Those places still exist, sadly.
That's the reality of it. You don't need shiny frameworks or any of those tools to make money.
Are developers happy with it? Maybe! Nothing wrong with spicing up a site with a little jQuery. Heck, I used Alpine.js on a brand new site and it's great. No build step, just works!
Frontend seems to be React, rest is dead, everyone's on React.
Build system seems to work. Last time I used vite and didn't tinker with it at all. It just works. That's good. It was a royal pain for in in the past. All those grunts, webpacks, gulps and whatnot. But it doesn't seem like dust is settled yet. I guess more build systems will appear and disappear in the future.
State storage: I don't know. Redux was hot in the past. Nowadays it seems to be react-query which is supposed to be wrapper around fetch but apparently its caching is good enough to replace the whole state storage framework. Sounds weird, but here we are.
Routing is weird. I don't understand what's with it. There's react-router but there are some fuss with latest version, with react-query compatibility.
Code quality tools are not complete. There's prettier which is nice but does not work for everything as they have some weird artificial constraints, like they don't want to insert curly braces automatically, so you need to use eslint. Configuring this stuff still is pain. Deno is awesome in that aspect.
What I miss in JS ecosystem is something single which solves all my problems. Like npm which can also build website, which can hot reload it for dev mode, which can autoformat my code with single blessed unconfigurable code style, which can lint it, which can run unit tests and so on. I don't want to spend a single second setting up my environment.
For this, you have Next.js/SvelteKit/Nuxt.js/whatever framework you prefer. For React in particular, Next.js with the default setup has all of these features but unit testing (there's a template for that, but it isn't as commonplace in frontend as it should be), and more such as server-side rendering, routing, data fetching, etc.
But often I find myself writing logic in the frontend, say for processing data from the API. That's where I want to create a file and write a unit test because it would actually be easier. Sadly for a small project the effort of configuring and maintaining updates of an external test framework on-top of Next makes no sense.
I remember a few months back I was working on a react app with react router and trying to figure out how to hook into all route changes for some reason, and all the documentation centered around "picking a router," of which there was `createBrowserRouter`, `createHashRouter`, etc, all which had different considerations. But I couldn't find an invocation for any of those! Just a single `useRoutes` and that was it lol. And the argument for it was just objects and arrays, with element properties set to JSX. From my understanding, we shouldn't have had history working at all without explicitly setting it to do so, but it all was working, so... who knows?
One thing that I imagine would cause issues (or make react-query at least partially redundant) is the `loader` prop that React Router now has that allows is to do data fetching and posting in the router. I didn't try that due to time constraints.
The biggest pain for me in Javascript is tool configuration, it's something that I'm just not good at and configuring Prettier, eslint, testing library (with mocks), tsc, … and all the rules that inevitably start crashing with each other is hell. That's why for the longest time I kept using CRA which had all these things preconfigured with sane defaults. But CRA development is moving at a crawl and with the lack of SSR NextJS makes much more sense so I'm focussing on that now.
Looking at the "retention, interest, usage, and awareness ratio over time" - Percentages: almost perfectly flat. Rankings: all slowly going down.
Relative feelings are in near perfect lock-step. The only thing to note is people, as always, have ennui and are looking for something new.
There is nothing to support your statement, at all. You are basically lying.
SvelteKit can do that.
--- start misquote ---
There's no wonder react has been popular for all this time. We needed a time of relative stability and gradual evolution. We don't need revolutions every year.
It gave time to think about hard problems, and come up with new solutions. There's intensive work being done right now on things like proper partial hydration, SSR, granular reactivity etc.
--- end misquote ---
This is partly reflected in the graphs as well: react dominates, but "new kids on the block" like Svelte and Solid have insane rates of interest and retention.
None of the major frameworks and barely any of the newcomers use them... well, for anything.
(Of course the person responsible for them tries to downplay it because biased etc. https://toot.cafe/@slightlyoff/109669688324474159 )
https://2022.stateofjs.com/en-US/libraries/front-end-framewo...
So that graphic excludes JavaScript itself.
But to your point, I get the impression every project is adopting TS in some form. It's now pretty rare for me to find an NPM library that doesn't have typings, and anecdotally I'd say at least half are provided by the project. And I've seen a lot of "migrated to TS" in project changelogs.
I think they should have had it in the main selection as - at least to me - sounds improbable that really so few use vanilla JS these days.
Edit: fix the number to use "% of question respondents".
https://insights.stackoverflow.com/survey/2021#demographics-...
Means that this survey may not be as representative. But with the info you gave, it might be.
I don't think it's as extreme as ~5%, though.
> only 5.2% women?
You answered your own question though.
There is no magical answer.
What is curious though is why you think any of that matters.
Its like saying: I know zebras have stripes but do zebras have stripes only?
And I was not asking for any "magical answer", just wanted to know if this survey is representative enough (others have already answered it, so all good now.)
It's missing alot.
I'm interested in a whole breakdown of Javascript in the backend.
Let the newest, slickest, shiniest batch of Javascript web frameworks commence! Oh boy.
Maybe something that compiles to wasm? Idk
Plus even if there's some degree of persistent trendchasing in the web front end space, there's also those who always go for the old "boring" options when making choices of this nature, and better baked-in components would serve these devs well.
This has been happening gradually for the past decade and now jquery is no longer necessary.
Even so, I’d like to see it improve further and at a faster pace.