d3bug3r
d3bug3r

Reputation: 2586

"React" in a way of ReactJS

I have been working on AngularJS and BackboneJS for a couple of months, and mainly I use them for my Ruby on Rails application. But recently many companies such as Airbnb and Instagram have adapted to Reactjs developed by Facebook.

Here are a few questions that bother me:

  1. How is ReactJS different from the rest of other javascript libraries when it comes to the View part of MV* or MVC?
  2. When should or shouldn't use ReactJS for my apps?
  3. What is the difference between DOM manipulation and virtual DOM?
  4. Is ReactJS is more than just a View?

Upvotes: 3

Views: 122

Answers (1)

yangli-io
yangli-io

Reputation: 17344

  1. Similar to directives in Angular. React is purely made using Components. It's similar to a directive in some ways, but unlike directives, react components can be made into pure functions and are much easier to test.

  2. Great for big projects, slow to prototype compared to something like Angular. ReactJS is great for any serious project because it's easy to pick up and maintain compared to other libraries.

    However, I've also found that ReactJS will take more time to set up compared to other libraries since it only does the V in MVC.

  3. Virtual DOM is done in memory. Proper DOM operations are costly so React introduced shadow DOM/virtual DOM, this is pretty much a mimic of the DOM in memory and not printed out onto the screen.

    Think ng-repeat in Angular, every time one item changes in ng-repeat it repaints the whole 1000 items you have on screen.

    The same thing in React will happen, except that repaint occurs in memory and then React determines that only 1 item has really changed and will only repaint one item on screen.

  4. For the most part, React only handles the view of a webpage. Flux was introduced by Facebook as a method of handling data.

Upvotes: 3

Related Questions