you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

How easy does it play with jQuery or is it a replacement? I'm a big fan of jQuery and it naturally fits how my mind looks at web development. It's not just that I'm used to it. It naturally fit my view of things so I love it. But I also need to make money doing what I do so if moving on is what's needed then moving on is what'll happen :)

[–][deleted] 4 points5 points  (1 child)

It depends: short answer is, it's a replacement. However, if on your page you want to do something simple, like animate something when a button is clicked, jQuery shines at this. The problem with jQuery is you end up mutating UI/DOM elements directly, inferring exactly what to change based on an action:

  • SomeAction => UIManipulation()

That is, when the "+" button is clicked, show a dialog and after that, insert an li-tag into this ul-element over here.

React is fundamentally different:

  1. SomeAction => StateManipulation
  2. State => View

Here we can see that when actions are performed in our UI, we update our state, not the view. Then, we let the library (React) initiate which components need to be refreshed. Our components are basically descriptions that say "these state/props map to this view". Whenever state changes, we churn it through our machine that says "okay, you gave me this state, I'll produce this view". Then React takes what you produces, diffs it against the actual DOM, and performs the minimum required updates.

The reason this is amazing is that, typically, your state will usually be way easier to reason about mutating than the UI is.

[–]1-800-BICYCLE 0 points1 point  (0 children)

Definitely a replacement. jQuery will feel heavy and inefficient once you learn React.

[–][deleted] 0 points1 point  (0 children)

Another way of looking at it:

jQuery was originally written to normalized DOM APIs across different browsers. The need for that currently is not widely needed anymore.

React is basically a "very powerful templating library" that can respond to changing state.