It’s been awhile since I did any frontend work. Is there something that has taken jQuery’s place?

  • 𝒍𝒆𝒎𝒂𝒏𝒏@lemmy.one
    link
    fedilink
    arrow-up
    23
    ·
    11 months ago

    A lot of jQuery’s features are now available in native JS - would also suggest just using native JS anyway because jQuery won’t throw any errors into the console if a selector matches no elements etc.

    The only additional library I’ve needed recently for (personal work) is Axios for requests - easier than working with the Fetch API in some cases

    • Nerd02@lemmy.basedcount.com
      link
      fedilink
      English
      arrow-up
      8
      ·
      11 months ago

      Axios for requests - easier than working with the Fetch API in some cases

      May I ask what cases? I used to use Axios on Node, before they implemented the fetch API over there but I haven’t touched it since. And defintiely never used it on the client. Could you make an example of some case where it’d be easier to work with Axios than with fetch?

      • 𝒍𝒆𝒎𝒂𝒏𝒏@lemmy.one
        link
        fedilink
        arrow-up
        7
        ·
        11 months ago

        For me it’s the ability to set up a shared instance with the base request URL, and set headers for things like the user’s token, allowing all requests made with that shared Axios instance to be sent to the right path with the token without needing to define them for each individual request.

        To be honest though something similar can be done with spread syntax in the Fetch API’s options parameter