Component test questions using useReactiveVar, makeVar

We are conducting the test using the react-testing-library.

In the attached code, the first rendered component remains in state in the second rendered component.

There seems to be a scope issue with “import {isSelectedPostVar} from ‘apollo/store/post’;”.

I’m curious about the solution.

// Component
import React, { useState } from 'react';
import { isSelectedPostVar } from 'apollo/store/post';
import { useReactiveVar } from '@apollo/client';

const Post = () => {
  const isSelectedPost = useReactiveVar(isSelectedPostVar);

  return (

Test Code

function renderComponent() {
   render(<Component />);
   // .....

   it first test
   it second test
      // The component status of the first test is maintained.

Have you tried resetting the reactiveVar at the end of each test? If the reactiveVar is not being changed its current state will leak into the next test