ReactCollect icon indicating copy to clipboard operation
ReactCollect copied to clipboard

mobx中autorun的触发顺序

Open ckinmind opened this issue 8 years ago • 2 comments

做项目的时候遇到一个问题,有一个全局的值分别有两个地方用autorun监听这个值的变动,那么这个监听触发的顺序的先后是什么,这个两个地方(react环境)如果是兄弟组件, 父子组件,这个顺序会怎么样

ckinmind avatar Feb 02 '18 03:02 ckinmind

no guarantee ref: https://github.com/mobxjs/mobx/issues/686

exoticknight avatar Feb 27 '18 06:02 exoticknight

@exoticknight 感谢, 我自己测试的结果似乎在父子组件中监听同一个值,父组件的autorun会先触发

ckinmind avatar Feb 27 '18 08:02 ckinmind