Not sure what is exactly the problem, but solved it by switching back to native tsc for transpiling the library.
I have a monorepo, and tried to create a react hook that I would use to a sibling package in the monorepo. Unfortunately, I faced an issue which I couldn't resolve.
The issue is also attached as an image:
react-dom.development.js:26923 Uncaught TypeError: Cannot read properties of null (reading 'useMemo')
at useMemo2 (react.development.js:1650:21)
at useTTQuery (index.tsx:16:18)
at ReproduceComp (App.tsx:4:20)
at renderWithHooks (react-dom.development.js:16305:18)
at mountIndeterminateComponent (react-dom.development.js:20074:13)
at beginWork (react-dom.development.js:21587:16)
at beginWork$1 (react-dom.development.js:27426:14)
at performUnitOfWork (react-dom.development.js:26557:12)
at workLoopSync (react-dom.development.js:26466:5)
Not sure what exactly is the cause of this issue, but pretty sure it's something to do with the building process, as with pure tsc it works as expected, as there is not any weird hook violation as described.
Hey folks,
Not sure what is exactly the problem, but solved it by switching back to native
tsc
for transpiling the library.I have a monorepo, and tried to create a react hook that I would use to a sibling package in the monorepo. Unfortunately, I faced an issue which I couldn't resolve.
The issue is also attached as an image:
Not sure what exactly is the cause of this issue, but pretty sure it's something to do with the building process, as with pure
tsc
it works as expected, as there is not any weird hook violation as described.The reproduction link: https://github.com/konsalex/tsup-reproduction-react
Upvote & Fund