-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not work with react-redux connect. #6
Comments
The current implementation does not allow: connect()(
ContextConsumerHOC(SomeContext)(SomeComponent)
) the current workaround is as follows: ContextConsumerHOC(SomeContext)(
connect()(SomeComponent)
) but the functionality to pass the reference down doesn't work anymore. |
I'm working with |
Is that related to the |
@daviscabral I'm not sure I follow |
There was some on going changes related to it that made me work with {
...
"scripts": {
...
"build:redux": "cd node_modules/redux/ && npm install --ignore-scripts && cross-env NODE_ENV=cjs rollup -c -o lib/redux.js",
"build:react-redux": "cd node_modules/react-redux/ && npm install --ignore-scripts && cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"preinstall": "run-p build:redux build:react-redux"
},
...
"dependencies": {
"react-redux": "reduxjs/react-redux",
"redux": "reduxjs/redux",
...
}
} |
I hope this helps: Using the latest version of redux and react-redux (which I'm not sure I would recommend) should not have anything to do with this issue. To answer your question,
This issue is not related to The bug described in this issue is related to an invariant in react-redux codebase that checks if the composed component passed to If you are not interested in the React.forwardRef functionality for now, a simple solution is to install react-context-consumer-hoc v1.0.3. React.forwardRef was added in react-context-consumer-hoc v1.0.4. npm install --save --save-exact [email protected] NOTE: All this should be fixed as soon as react-redux updates the invariant, which is what reduxjs/react-redux#971 is trying to do. Because you might be looking into why this bug is going on, here is some side context: When React collaborators released React.forwardRef, they suggested that adding it to any library should be reflected in a major version increase. When I found this out, I should have reverted the change and release it into a patch version and then release a new major version with this functionality. But, I decided NOT to do that because I do not know if some people are already expecting this behavior in their codebase. |
Cool, thank you for the "context" (lol). So, that thing about But again, thanks for taking the time to give me context - I hope to contribute here later. 👍 |
Because of the time that has taken for Sadly, this workaround won't be implemented in version 1 of this library. It will be added to version 2. |
With the new React.forwardRef added, the library does no longer works with react-redux.
See: reduxjs/react-redux#914 for more information.
We need to:
The text was updated successfully, but these errors were encountered: