title: React Hook "useCategory" cannot be called inside a callback
body: <p>Here is my code</p>
  
  <pre><code>import React, { FC, useState,useMemo } from "react";
  
  const FormSearch: FC&lt;{ params: string }&gt; = ({
     params 
  }) =&gt; {
    const [category, useCategory] = useState&lt;string&gt;("All");
    const [search, setSearch] = useState&lt;string&gt;("");
    useMemo(() =&gt; {             
       const searchParams = new URLSearchParams(params);
      if (!!searchParams.get("Categories")&amp;&amp;!!searchParams.get("Search")) {
            useCategory(`${searchParams.get("Categories")}`); 
            setSearch(`${searchParams.get("Search")}`);   
      } else {
        setSearch("");
        useCategory("All")
      }
    }, [params]);
  
    return (
      &lt;div&gt;1000&lt;/div&gt;
    );
  };
  </code></pre>
  
  <p>I get these errors</p>
  
  <p>Line 16:  React Hook "useCategory" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
    Line 20:   React Hook "useCategory" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks</p>