Uncaught TypeError: (0 , react_redux_1.connect) is not a function

53 views Asked by At

I am trying to make the legacy react code work using latest version of redux ("redux": "^5.0.1"). I have this legacy code as part of package (generated from a different project using npm pack). In the main application, i am calling this component, and it fails with below error -

Uncaught TypeError: (0 , react_redux_1.connect) is not a function at ./node_modules/@test/common-package/dist/authentication/components/LoginCallback.js (LoginCallback.tsx:20:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:22:1) at fn (hot module replacement:61:1) at ./node_modules/@test/common-package/dist/authentication/index.js (index.ts:1:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:22:1) at fn (hot module replacement:61:1) at ./node_modules/@test/common-package/dist/reducers/index.js (index.ts:2:1) at options.factory (react refresh:6:1)

Here is the sample code for the component in package for your reference:

https://i.stack.imgur.com/JxEMg.png

it fails in this code - const connector = connect(undefined,mapDispatchToProps);

Any idea what might be going wrong here?

Edit: If i use the connect directly from the main application, without using package, it works fine. But the connect does not work, if i use it in package.

0

There are 0 answers