1

Last night, I saw some argument between redux & mobX in Twitter.

I spent a couple of hours to study mobX. In my opinion, redux is awesome, and Dan is my idol. So I think redux is fast than mobX.

I saw the mobx-react-todomvc. I try to modify it, and I find out it pass the props only layer by layer. It is my problem?

4

2 回答 2

2

这不是要求,只是个人喜好。但您也可以使用上下文,例如使用 mobx-connect 包。如果愿意,您甚至可以使用依赖注入或简单地将存储导入组件文件中。完全没有使用道具的技术要求。

于 2016-06-12T06:32:37.560 回答
1

谢谢@capajj

我从不通过道具通过多个组件传递任何 mobx 可观察对象。只需将它们导入我需要的地方

我认为这是一个很好的答案,我喜欢这个主意!

于 2016-06-12T09:36:20.737 回答