Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是使用 Blazor 和 Fluxor 的新手,我试图决定什么更好用
IActionSubscriber - 手动注入、订阅和取消订阅
或者
继承 FluxorComponent - 并使用 ActionSubscriber
什么是最好的解决方案?有什么好处和坏处?
继承 fromFluxorComponent有几个优点,你不需要一直手动调用,也不需要StateHasChanged注入IActionSubscriber,因为它是免费包含的,而且你不必记得在处理时取消订阅组件。
FluxorComponent
StateHasChanged
IActionSubscriber
功能方面,我认为没有任何区别,只是它FluxorComponent会为您处理一些工作。
我能想到的唯一缺点是,如果继承自FluxorComponent阻止您从另一个基组件类继承。
至于我自己,我只是继承FluxorComponent和去。它工作得很好。