1. 13

  2. 5

    I know this is satire but it is not uncommon to see programmers lately who claim to only know React and can’t write vanilla JS.

    1. 2

      There is also this very useful list of vanilla JS tools : https://vanillalist.top

      1. 2

        Gonna whine a bit but like…. seriously, people who write this kind of “takedown” of stuff like jQuery are exhausting.

        Yeah, you work at like some agency and you have a “sprinkle of interactivity” and you can just write up the tiny script, and that will work. Yeah, sure, maybe that’s the right balance.

        People who grab these tools are writing way more stuff, working on a team, and value being able to maintain this stuff over squeezing performance.

        Like the AJAX snippet:

        var r = new XMLHttpRequest();
        r.open("POST", "path/to/api", true);
        r.onreadystatechange = function () {
          if (r.readyState != 4 || r.status != 200) return;
          alert("Success: " + r.responseText);

        Seriously? This is your big response to $.ajax? Like you think this is good or easy to manage? Nice lack of error handlign too by the way.

        Maybe I’m just not the target for this. But given that jQuery, in particular, has such a good API that people go out of their way to port it to other languages, I’m not super interested in hearing people whine about jQuery’s relative performance and propose spaghetti in exchange.

        (Much love to the people who got stuff like fetch to exist though, actually improving the base libraries from stuff learned from the community is very appreciated)

        1. 2

          Seriously? This is your big response to $.ajax? Like you think this is good or easy to manage? Nice lack of error handlign too by the way.

          Just make a function. You don’t need jQuery.

          1. 1

            Ignoring the existence of fetch for a minute (which is what I do nowadays instead of $.ajax now that standard stuff has caught up)…

            I can go in and try out XMLHttpRequest. I can call the lifecycle methods, and make sure to add headers correctly. I can also make sure not to fuck up the lifecycle of that object when calling open and all that. Capture some callbacks, or maybe use a promise library.

            And now I’m like halfway down implementing $.ajax. There’s a thing “on the market” that does stuff nicely. It doesn’t have weird idiosyncracies to track down, it lowers the bar in general (there are probably more people who can safely use $.ajax than people who can safely implement $.ajax), and it will probably work.

            I think there’s more nuance when you go down the “endless frameworks” or whatever. But here’s a self-contained thing that works nicely. I think if your metric is “I want things to work”, there’s few arguments for not using this. Perf arguments are there, but I don’t really buy the “random web dev will write more performant stuff when being forced to implement stuff themselves”.

        Stories with similar links:

        1. Vanilla JS - The best framework for JS via qbit 8 years ago | 5 points | no comments