【问题标题】:Blazor State with using Fluxor: ActionSubscriber or SubscribeToAction what is better to use?使用 Fluxor 的 Blazor State:ActionSubscriber 或 SubscribeToAction 哪个更好用?
【发布时间】:2021-08-09 18:48:04
【问题描述】:

我是使用 Blazor 和 Fluxor 的新手,我试图决定什么更好用

IActionSubscriber - 手动注入、订阅和取消订阅

继承 FluxorComponent - 并使用 ActionSubscriber

什么是最好的解决方案? 有什么好处和坏处?

【问题讨论】:

    标签: .net blazor fluxor


    【解决方案1】:

    FluxorComponent继承有几个优点,你不需要一直手动调用StateHasChanged,也不需要注入IActionSubscriber,因为它是免费提供的,并且您不必记住在处置组件时取消订阅。

    在功能方面,我认为没有任何区别,只是 FluxorComponent 会为您处理一些工作。

    我能想到的唯一缺点是,如果从 FluxorComponent 继承会阻止您从另一个基组件类继承。

    至于我自己,我只是从FluxorComponent 继承然后去。效果很好。

    【讨论】:

      猜你喜欢
      • 2020-11-29
      • 1970-01-01
      • 2019-09-21
      • 2011-04-09
      • 1970-01-01
      • 2021-04-06
      • 2019-07-06
      • 2011-02-27
      • 2018-11-13
      相关资源
      最近更新 更多