Content Deep Dive
Apollo Client’s new imperative store API
Blog post from Apollo
Post Details
Company
Date Published
Author
Caleb Meredith
Word Count
1,587
Language
English
Hacker News Points
-
Summary
The Apollo Client now provides a new imperative store API, allowing developers to control the data in their cache. This API includes four methods: `readQuery()`, `readFragment()`, `writeQuery()`, and `writeFragment()`. These methods enable developers to read and write directly to the cache, providing complete control over the data. The new API also includes an `update` method that allows for imperative updates of the cache after a mutation, making it easier to manage optimistic mutation updates in a transparent way. This new API is designed to provide a GraphQL-shaped client-side database, allowing developers to use Apollo Client as a flexible and powerful tool for managing their data.