简体   繁体   English

Mobx:交易

[英]Mobx : Transaction

Q1:Do we need transaction , when an observablearray.replace is used ? 问题1:使用observablearray.replace时,我们需要交易吗?

as per this link https://mobxjs.github.io/mobx/refguide/transaction.html 按照此链接https://mobxjs.github.io/mobx/refguide/transaction.html

it mentioned during push of each item. 它在推送每个项目时都提到过。

Q2:Does Transaction improve the performance or its just to wrap so that render happens only after the transaction is completed . 问题2:Transaction是否提高了性能或其包装效果,以便仅在事务完成后才进行渲染。

Observers are not notified until after the replace is complete, so there is no need for a transaction, as demonstrated by this example . 直到替换完成后才通知观察者,因此不需要事务,如本示例所示

Transaction is just a way to avoid observers from being synchronously notified of a change in observables until the transaction is done. 事务只是避免观察者在完成事务之前被同步通知可观察到的变化的一种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM