title: TypeError: getItem is not a function when testing a component with node module hooks
body: <p>I am learning React, and got stuck in testing one of my components.
  I use react-use-cart to manage the cart, this is how code looks</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from "react";
  import { Link } from "react-router-dom";
  import { useCart } from "react-use-cart";
  import PropTypes from "prop-types";
  
  import handleQuantityChange from "../../logic/product/handleQuantityChange";
  
  function AddToCart(props) {
      const {product, styles, loading} = props;
      const { addItem, inCart, getItem, updateItemQuantity } = useCart();
      const productInCart = getItem(product.id);</code></pre>
  </div>
  </div>
  </p>
  <p>The test breaks at &quot;productInCart = getItem(product.id)&quot; saying &quot; TypeError: getItem is not a function&quot;.
  I've been stuck at this for several days, and would really appreciate some help, it's my first time asking a question, so if you need any more info let me know, thank you.</p>
  <p>Also about the test, test breaks on the render stage</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from "react";
  import { render, screen } from "@testing-library/react";
  import AddToCart from "../AddToCart";
  import { MemoryRouter as Router } from "react-router-dom";
  describe("get item is not a function", () =&gt; { 
      const product = {
          name: "test name",
          imgUrl: "test image",
          price: 555,
          shipping: 1000,
          id: 55
      }; 
      const styles = []
  
  
      beforeEach(() =&gt; {
          render(
              &lt;Router&gt;
                  &lt;AddToCart product={product} styles={styles}/&gt;
              &lt;/Router&gt;
          );
      });</code></pre>
  </div>
  </div>
  </p>