问题
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.
回答1:
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:
- React for the stupid people
- Rebuilding Hipchat with React
- Why React?
And probably one of my favorite blog post Why React is awesome?
来源:https://stackoverflow.com/questions/28442239/advantages-and-disadvantages-of-using-reactjs