immer 的原理是什么,为什么它的性能更高
Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 632
Author 回答者: shfshanyue
const state = {
user: { id: 3 },
role: { name: "admin" },
};
const proxyState = new Proxy(state, {
get(target, prop) {
return target[prop];
},
});
//=> True
state !== proxyState;
//=> True
state.user === proxyState.user;