60

I am new to using React for development.

Can someone list the advantages and disadvantages in using ReactJS. Are there any performance issues with using this library for large projects.

rene
  • 41,474
  • 78
  • 114
  • 152
XpertSiji
  • 811
  • 1
  • 6
  • 8

1 Answers1

54

Advantages of using React:

  • easy to know how a component is rendered, you just look at the render function.
  • JSX makes it easy to read the code of your components. It is also really easy to see the layout, or how components are plugged/combined with each other.
  • you can render React on the server-side.
  • it is easy to test, and you can also integrate some tools like jest.
  • it ensures readability and makes maintainability easier.
  • you can use React with any framework (Backbone.js, Angular.js) as it is only a view layer.

What is not so good about React?

  • it is only a view layer, you have still to plug your code for Ajax requests, events and so on. Some people get surprised by that.
  • the library itself is pretty large.
  • the learning curve can be steep.

If react-native is really how it was described, react is going to become even bigger.

Performance wise, it is really good as it relies on a virtual-dom to know what is really changing in your UI and will re-render only what has really changed. It does have trouble with very large, slightly changing, lists of children (2000 <li> test), but can be optimized simply.

If you are not sure, just think about the big projects using React: instagram, hipchat, facebook chat and so on.

Some resources:

And probably one of my favorite blog post Why React is awesome?

Jeremy D
  • 4,787
  • 1
  • 31
  • 38
  • 2
    I want to add some comments to your answer as I believe it's prudent to point out. First off, React does _not_ come with Jest, Jest can be used to test React components but is not required. Secondly, React never aimed to be anything else other than the view layer which shouldn't be held against it. React promotes composability and not lock-yourself-in-a-framework-ability. – Henrik Andersson Feb 11 '15 at 08:07
  • 1
    You are right, I was in a hurry when I wrote my first answer. I edited the answer to add your points in it. I still think that 'it is a view layer' should be in the cons part as a lot of people are surprised by it. – Jeremy D Feb 11 '15 at 15:09
  • I added a note about something that comes up often performance wise. Diffing large lists of children where there are few to none changes can result in a lot of wasted cpu cycles. People seem to expect this to just be fast, because 'react is fast'. – Brigand Feb 11 '15 at 16:23
  • Thanks! I didn't want to go into too much details but your point is valid. – Jeremy D Feb 11 '15 at 16:24