Reset store after logout with Apollo client

前端 未结 4 1997
深忆病人
深忆病人 2021-02-19 07:46

I\'m trying to reset the store after logout in my react-apollo application.

So I\'ve created a method called \"logout\" which is called when I click on a button (and pas

4条回答
  •  感动是毒
    2021-02-19 07:55

    you can use useApolloClient to access apollo client.

    import { useApolloClient } from "@apollo/client";
    
    const client = useApolloClient();
    
    client.clearStore();
    

提交回复
热议问题