How would I change some state from an Apollo Link in React

Hi everyone,

I am trying to check if any query response contains a specific trigger key (for password_confirmation_required in this case), so I could automatically show a modal/popup whenever a query has this specific trigger in the response. I am not quite sure if I am doing this the correct way, but it would be a nice approach to automatically show some modal whenever a trigger like this, exists.

I am already able to filter all incoming query responses, to see if my specific key exists, with an Apollo Link:

new ApolloLink((operation, forward) => {
  return forward(operation).map((data) => {
    // Here I can filter the data object and see if the response contains my key, and from here I would like to show some modal or run a modal-hook.
    return data;

I am not really sure how I would achieve something like this. I basically want to change some state from the Apollo Link. Maybe there could be better ways to achieve something like this. I am using Apollo Client in a Next.js project.

Hopefully someone is able to help me out.
Thanks a lot!