title: React - Can't use hooks in custom hooks
body: <p>I have weird issue. I'm trying to create new hooks in reactjs. But i cannot use useEffect, useState and other React Hooks in my custom hook. I'm researching it but i couldn't find any solution. Here is my custom hook:</p>
  
  <pre class="lang-js prettyprint-override"><code>export function useStore(initialState) {
    const [state, setState] = useState(initialState);  
    const store = state;
  
    return store;
  }
  </code></pre>
  
  <p>When im trying to use: useStore('foo'); i get this error:</p>
  
  <pre><code>Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
  See error link to react (I can't share link...) for tips about how to debug and fix this problem.
  </code></pre>
  
  <p>I also tried to delete useState hook in my code. And it worked that's why in my point of view that problem is hooks. Can someone help me?</p>
  
  <p>Thank you :)</p>