【发布时间】:2018-07-03 11:24:23
【问题描述】:
我正在浏览mutation doc,想知道cache.readQuery 是否返回副本?
例如:
const { todos } = cache.readQuery({ query: GET_TODOS });
// Should I copy it first or is it already copied?
// todos = Object.assign({}, todos)
todos.items.concat([addTodo])
cache.writeQuery({
query: GET_TODOS,
data: { todos: todos }
});
【问题讨论】:
标签: reactjs apollo apollo-client