Aglowid IT Solutions's answer to What is the difference between jquery and react? - Quora

jQuery is a cross-platform JavaScript library. It’s free, open-source beneficial for work that involves DOM and Ajax requests. While jQuery has already become irreplaceable in some contexts, it may not fit the needs of every application and limit your options. Whereas React helped the industry move from creating web apps to building complex, large scale single page applications. As a result, more and more developers and dev teams are switching over to using React.

What is the difference between JQuery, AngularJS and ReactJS? - Quora

AngularJS turned the whole definition of web development through its existence, what was lacking in previous methods of development was inappropriate structure. It merges use of JavaScript with MVC and HTML with DOM.


jQuery Full Course - jQuery Tutorial From Beginner to Advanced - Learn jQuery 2019

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. In this video, you'll learn jQuery from Beginner to Advanced

jQuery is open-source software using the permissive MIT License. Web analysis indicates that it is the most widely deployed JavaScript library by a large margin.

Mastering jQuery will boost up your career specially in web development. This course is designed you to master yourself in jQuery through step by step process.

Course Contents

  • jQuery Intro
  • What is jQuery and what you will learn?
  • Downloading jQuery
  • jQuery Basics
  • A first look at jQuery code
  • Selectors and Filters
  • Replacing contents
  • Handling events
  • Hide/Show events
  • Fading
  • Slide
  • Toggle
  • Animate
  • Selectors
  • Filters
  • jQuery Advanced
  • Advanced Selectors
  • Creating Content
  • Creating Content: Part 2
  • Inserting content
  • Modifying content
  • Modifying CSS
  • Final thoughts


What you’ll learn

  • Will become Master in client side web development
  • Will become expert in jQuery
  • Will earn working experience on jQuery
  • Are there any course requirements or prerequisites?
  • Prior experience on HTML and CSS required.
  • Who this course is for:
  • Who wanna expert in client side web development
  • Who wanna expert in jQuery


Thanks for watching

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Should use CSS, jQuery or React to Filtering Data Client-Side

Should use CSS, jQuery or React to Filtering Data Client-Side

Filtering Data Client-Side. Let's look at how we might do that with different technologies is CSS, jQuery, and React

Say you have a list of 100 names:

<ul>
  <li>Randy Hilpert</li>
  <li>Peggie Jacobi</li>
  <li>Ethelyn Nolan Sr.</li> 
  <!-- and then some -->
</ul>

...or file names, or phone numbers, or whatever. And you want to filter them client-side, meaning you aren't making a server-side request to search through data and return results. You just want to type "rand" and have it filter the list to include "Randy Hilpert" and "Danika Randall" because they both have that string of characters in them. Everything else isn't included in the results.

Let's look at how we might do that with different technologies.

CSS: can sorta do it, with a little help.

CSS can't select things based on the content they contain, but it can select on attributes and the values of those attributes. So let's move the names into attributes as well.

<ul>
  <li data-name="Randy Hilpert">Randy Hilpert</li>
  <li data-name="Peggie Jacobi">Peggie Jacobi</li>
  <li data-name="Ethelyn Nolan Sr.">Ethelyn Nolan Sr.</li> 
  ...
</ul>

Now to filter that list for names that contain "rand", it's very easy:

li {
  display: none;
}
li[data-name*="rand" i] {
  display: list-item;
}

Note the i on Line 4. That means "case insensitive" which is very useful here.

To make this work dynamically with a filter <input>, we'll need to get JavaScript involved to not only react to the filter being typed in, but generate CSS that matches what is being searched.

Say we have a <style> block sitting on the page:

<style id="cssFilter">
  /* dynamically generated CSS will be put in here */
</style>

We can watch for changes on our filter input and generate that CSS:

filterElement.addEventListener("input", e => {
  let filter = e.target.value;
  let css = filter ? `
    li {
      display: none;
    }
    li[data-name*="${filter}" i] {
      display: list-item;
    }
  ` : ``;
  window.cssFilter.innerHTML = css;
});

Note that we're emptying out the style block when the filter is empty, so all results show.

jQuery: makes it even easier.

Since we need JavaScript anyway, perhaps jQuery is an acceptable tool. There are two notable changes here:

  • jQuery can select items based on the content they contain. It has a selector API just for this. We don't need the extra attribute anymore.
  • This keeps all the filtering to a single technology.

We still watch the input for typing, then if we have a filter term, we hide all the list items and reveal the ones that contain our filter term. Otherwise, we reveal them all again:

const listItems = $("li");

$("#filter").on("input", function() {
  let filter = $(this).val();
  if (filter) {
    listItems.hide();
    $(`li:contains('${filter}')`).show();
  } else {
    listItems.show();
  }
});

It's takes more fiddling to make the filter case-insensitive than CSS does, but we can do it by overriding the default method:

jQuery.expr[':'].contains = function(a, i, m) {
  return jQuery(a).text().toUpperCase()
      .indexOf(m[3].toUpperCase()) >= 0;
};

React: can do it with state and rendering only what it needs.

There is no one-true-way to do this in React, but I would think it's React-y to keep the list of names as data (like an Array), map over them, and only render what you need. Changes in the input filter the data itself and React re-renders as necessary.

If we have an names = [array, of, names], we can filter it pretty easily:

filteredNames = names.filter(name => {
  return name.includes(filter);
});

This time, case sensitivity can be done like this:

filteredNames = names.filter(name => {
  return name.toUpperCase().includes(filter.toUpperCase());
});

Then we'd do the typical .map() thing in JSX to loop over our array and output the names.

I don't have any particular preference

This isn't the kind of thing you choose a technology for. You do it in whatever technology you already have. I also don't think any one approach is particularly heavier than the rest in terms of technical debt.

Thanks for reading! Please share if you liked it!

Originally published on css-tricks.com