title: React API context function is not working
body: <p>I am implementing this example <a href="https://www.youtube.com/watch?v=5LrDIWkK_Bc" rel="nofollow noreferrer">video</a> but it doesn't work in my case. Here is the code</p>
  <p><strong>Context API file</strong></p>
  <pre><code>    const SearchparamsUpdateContext = React.createContext();
  
      export function Usesearchdata() {
        return useContext(SearchparamsContext);
      }
      export function Usesearchupdate() {
        return useContext(SearchparamsUpdateContext);
      }
      export function Searchparams({ children }) {
        const [searchdata, setSearchdata] = useState(false);
  
        function Handlesearch() {
          setSearchdata((prevsearchdata) =&gt; !prevsearchdata);
        }
        return (
          &lt;SearchparamsContext.Provider value={searchdata}&gt;
            &lt;SearchparamsUpdateContext.Provider value={Handlesearch}&gt;
              {children}
            &lt;/SearchparamsUpdateContext.Provider&gt;
          &lt;/SearchparamsContext.Provider&gt;
        );
      }
  </code></pre>
  <p><strong>APP Header file</strong>
  Here I am calling the Usesearchupdate Hook. I can access the value but not able to call update function</p>
  <pre><code>export default function AppHeaderDropdown() {
            const handledata = Usesearchupdate();
            return (
              &lt;button
                      onClick={handledata}
                      type=&quot;button&quot;
                      className=&quot;clr-orange theme-btn&quot;
                    &gt;
                      &lt;FaCalendarAlt /&gt;
                    &lt;/button&gt;
            );
          }
  </code></pre>