diff --git a/docs/source/advanced/caching.md b/docs/source/advanced/caching.md index 09ea8a9aca5..e00f9299c8b 100644 --- a/docs/source/advanced/caching.md +++ b/docs/source/advanced/caching.md @@ -147,6 +147,8 @@ const { todo } = client.readQuery({ }); ``` +Note that you should not modify the return value of `readQuery` because the same object may be reused between components. If you want to update the data in the cache, create a new replacement object and pass it to `writeQuery`. +

readFragment

This method allows you great flexibility around the data in your cache. Whereas `readQuery` only allowed you to read data from your root query type, `readFragment` allows you to read data from _any node you have queried_. This is incredibly powerful. You use this method as follows: