Mutable state
Important aspect of MobX state is its mutability.
On the contrary of popular solutions like Redux or useReducer which works best with immutable data structures, the MobX is based on direct mutability to notify any subscribers about the change.
Since reference to MobX state object doesn't change over time, you can avoid checks that are needed with immutable state.
It's very common pattern to see
shouldComponentUpdate
with a bulky checks to avoid unnecessary renders. This isn't needed with MobX at all.
example pending
当前内容版权归 mobx-react 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mobx-react .