React hooks in react library giving Invalid hook call error

后端 未结 6 1588
灰色年华
灰色年华 2021-02-12 13:17

I create a react library using https://www.npmjs.com/package/create-react-library And successfully used it on other React project. But when I tried to use react hooks functiona

6条回答
  •  长情又很酷
    2021-02-12 13:50

    I have created a React library with create-react-library this library is your General component. I have published it to npm here https://www.npmjs.com/package/stackoverflow-test and a React app for use it here https://codesandbox.io/s/mm7yl83o28.

    Just click on General component text and count will be incremented.

    I cannot reproduce your issue, just use this test to check your implementation.

提交回复
热议问题