使用ReactJS的优点和缺点 [英] Advantages and Disadvantages of using ReactJS

查看:153
本文介绍了使用ReactJS的优点和缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用React进行开发的新手。

I am new to using React for development.

有人列出使用ReactJS的优点和缺点。
对于大型项目使用此库是否存在任何性能问题。

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

推荐答案

使用React的优点:

Advantages of using React:


  • 很容易知道如何渲染组件,只需查看渲染功能即可。

  • JSX使您可以轻松阅读组件的代码。它也很容易看到布局,或组件如何相互插入/组合。

  • 你可以在服务器端渲染React。

  • 它很容易测试,你也可以集成一些像jest这样的工具。

  • 它确保了可读性并使维护更容易。

  • 你可以将React与任何框架(Backbone.js,Angular.js)一起使用,因为它只是一个视图层。

  • 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.

什么不是关于React好吗?

What is not so good about React?


  • 它只是一个视图层,您仍然需要为Ajax请求,事件等插入代码。有些人对此感到惊讶。

  • 库本身非常大。

  • 学习曲线可能很陡。

如果反应原生是真的如何描述,反应会变得更大。

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

性能方面,它非常好,因为它依赖于虚拟dom来了解UI中真正发生的变化,并且只会重新渲染真正改变的内容。对于非常大的,略有变化的儿童名单(2000 < li> 测试),它确实有问题,但可以简单地进行优化。

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.

如果你不确定,只要想想使用React的大项目:
instagram,hipchat,facebook chat等等。

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

一些资源:

  • React for the stupid people
  • Rebuilding Hipchat with React
  • Why React?

可能是我最喜欢的博文之一为什么React很棒?

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

这篇关于使用ReactJS的优点和缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆