Let's say I have some data that I obtained through a non-graphql endpoint for example from third party server (firebase).
How do I put the data into the local relay store? Is there an easy way to add / edit / overwrite data to relay store directly without going through query or mutation?
答案 0 :(得分:3)
可以从Relay.Store
实例访问非公开RelayStoreData字段,它可让您直接访问商店中包含的记录。我自己没有做过任何事情,但你可以尝试直接修改缓存:
RelayStore._storeData._cachedStore._records[recordId][fieldName]=newValue
答案 1 :(得分:0)
我会在没有服务器的情况下使用relay,在本地定义graphql架构并从graphql架构中执行API请求,就像查询架构中的数据库一样。