通读中继文档,我对网络层(https://facebook.github.io/relay/docs/en/network-layer.html)与中继存储(https:// facebook.github.io/relay/docs/en/relay-store.html)。
这是两个不同的缓存吗?哪一个会自动获得 Relay 收集的垃圾?
通读中继文档,我对网络层(https://facebook.github.io/relay/docs/en/network-layer.html)与中继存储(https:// facebook.github.io/relay/docs/en/relay-store.html)。
这是两个不同的缓存吗?哪一个会自动获得 Relay 收集的垃圾?
@anon 网络层是您将客户端连接到 GraphQL 服务器、在应用程序上创建存储以缓存数据的方式。第二个链接更多地是关于如何在运行突变后更新store
使用函数。updater
正如您在第一个链接中看到的:
// Create a network layer from the fetch function
const network = Network.create(fetchQuery);
const store = new Store(new RecordSource())
您正在使用relay-runtime
包创建网络层/存储。
希望能帮助到你 :)