title: React component with hooks as npm module
body: <p>When I try to use React Hooks in module which I use as dependency it's fail. 
  I'm getting a following error:</p>
  
  <pre><code>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:
  </code></pre>
  
  <p>But if I use class-based component, it's ok. Why can this happen?</p>
  
  <p>Here is excerpt from my <code>package.json</code></p>
  
  <pre><code>{
    "main": "dist/index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "build": "./node_modules/.bin/babel src -d dist",
      "prepublish": "npm run build"
    },
    "peerDependencies": {
      "react": "^16.10.2",
      "react-router-dom": "^5.1.2"
    },
    "devDependencies": {
      "axios": "^0.19.0",
      "jwt-decode": "^2.2.0",
      "qs": "^6.9.0",
      "@babel/cli": "^7.6.4",
      "@babel/core": "^7.6.4",
      "@babel/preset-env": "^7.6.3",
      "@babel/preset-react": "^7.6.3"
    }
  }
  </code></pre>
  
  <p>Here is the component:</p>
  
  <pre><code>const Test = () =&gt; {
    const [state, setState] = React.useState('test')
    return &lt;div&gt;{state}&lt;/div&gt;
  }
  </code></pre>