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/

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more