forked from reduxjs/react-redux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that component prop 'context' really contains a React context … (
reduxjs#1134) * Ensure that component prop 'context' really contains a React context before using it after switching to react-redux 6.0.0, we've had a lot of errors stating Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. all over in our app. After digging deeper, we've discovered that we use a lot of (connected) components using a property named 'context' which conflicts with your new connectAdvanced code. So maybe you can improve the check on this.props.context a little bit to ensure it is used only if it really contains a valid React context. * Update connectAdvanced.js * Update connectAdvanced.js * improved check whether context given as a prop is a real ReactContext * added test for ignoring non-react-context values passed as a prop to the component * Use react-is checks * Just check Consumer. Good enough! * improved check for context.Consumer * added missing export 'isContextConsumer' in rollup config
- Loading branch information
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters