📜  React Flux与MVC | Flux与MVC-JavaPoint

📅  最后修改于: 2020-12-20 02:45:55             🧑  作者: Mango

反应通量与MVC

MVC

MVC代表模型视图控制器。这是用于开发用户界面的体系结构模式。它将应用程序分为三个不同的逻辑组件:模型,视图和控制器。它于1976年以Smalltalk编程语言首次引入。在MVC中,每个组件都是为处理应用程序的特定开发方面而构建的。它是创建可伸缩项目的最常用的Web开发框架之一。

MVC架构

MVC体系结构包含三个组件。这些是:

  • 模型:它负责维护应用程序的行为和数据。
  • 视图:用于在用户界面中显示模型。
  • 控制器:它充当模型和视图组件之间的接口。它需要用户输入,操纵数据(模型)并导致视图更新。

助焊剂

根据官方网站的说法,Flux是Facebook用于构建客户端Web应用程序的应用程序体系结构。它是MVC架构和其他软件设计模式的替代方案,用于管理React应用程序中数据的流动方式。它是所有React应用程序的骨干。它既不是库,也不是框架。它补充了React的观点,并遵循单向数据流模型的概念。

Flux Architecture在处理数据方面具有三个主要角色:

  • 调度员
  • 专卖店
  • 视图(反应组件)

MVC与。助焊剂

SN MVC FLUX
1. It was introduced in 1976. It was introduced just a few years ago.
2. It supports Bi-directional data Flow model. It supports Uni-directional data flow model.
3. In this, data binding is the key. In this, events or actions are the keys.
4. It is synchronous. It is asynchronous.
5. Here, controllers handle everything(logic). Here, stores handle all logic.
6. It is hard to debug. It is easy to debug because it has common initiating point: Dispatcher.
7. It is difficult to understand as the project size increases. It is easy to understand.
8. Its maintainability is difficult as the project scope goes huge. Its maintainability is easy and reduces runtime errors.
9. Testing of application is difficult. Testing of application is easy.
10. Scalability is complex. It can be easily scalable.