DEV Community

Cover image for "jQuery vai morrer!!" [#SQN]
Jean Jar Pereira de Araújo
Jean Jar Pereira de Araújo

Posted on

3 1

"jQuery vai morrer!!" [#SQN]

No mundo onde estamos focados em produtividade, regra de negócio e entrega dizer que o jQuery vai morrer é um pouco contraditório.

"Ahhh, mas tudo que você faz com jQuery da pra fazer com JavaScript puro"

Claro que da, porém você vai precisar escrever MUITO mais código! Escrevendo mais você perde em produtividade e acaba desperdiçando tempo, e tempo é $$$dinheiro$$$!

Tempo é o insumo mais caro que você pode oferecer e se você puder fazer o mesmo entregando valor e escrevendo menos, porque que não utilizar jQuery?

Vamos aos exemplos!

"Da pra fazer requisição Ajax com JavaScript puro! não precisa usar jQuery"

var request = new XMLHttpRequest();
request.open('GET', '/my/url', true);

request.onload = function() {
  if (this.status >= 200 && this.status < 400) {
    // Success!
    var resp = this.response;
  } else {
    // We reached our target server, but it returned an error

  }
};

request.onerror = function() {
  // There was a connection error of some sort
};

request.send();

Legal né? agora vamos ver como podemos fazer utilizando jQuery

$.ajax({
  type: 'GET',
  url: '/my/url',
  success: function(resp) {

  },
  error: function() {

  }
});

ainda acha que o jQuery vai morrer?

vamos a outros exemplos

Trigger de eventos

var event = document.createEvent('HTMLEvents');
event.initEvent('change', true, false);
el.dispatchEvent(event);

E com jQuery?

$(el).trigger('change');

Mudou de ideia?


"E o VueJs e React??"
Como diz um professor meu "Não misture maçãs com bicicleta"

Segue alguns links de referências.

http://youmightnotneedjquery.com/
https://www.educba.com/vue-js-vs-jquery/

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay