How to disable cache in apollo-link or apollo-client?

前端 未结 3 1300
粉色の甜心
粉色の甜心 2021-02-01 00:21

I\'m using apollo-client, apollo-link and react-apollo, I want to fully disable cache, but don\'t know how to do it.

I read the source of

3条回答
  •  逝去的感伤
    2021-02-01 01:21

    I would always suggest not to disable inbuild caching feature from apollo client. Instead you can always set fetchPolicy: 'network-only' for an individual queries. Something like this

    
     {({ loading, error, data, refetch, networkStatus }) => {
       ...
     }}
    
    

    While fetching data with this Query, it would always do a network request instead of reading from cache first.

提交回复
热议问题