Skip to content

Commit 0e44ad1

Browse files
alexreardontimdorr
authored andcommitted
only running isValidElementType in development builds (#1069)
1 parent 7458311 commit 0e44ad1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/connectAdvanced.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ export default function connectAdvanced(
8888
}
8989

9090
return function wrapWithConnect(WrappedComponent) {
91-
invariant(
92-
isValidElementType(WrappedComponent),
93-
`You must pass a component to the function returned by ` +
94-
`${methodName}. Instead received ${JSON.stringify(WrappedComponent)}`
95-
)
91+
if (process.env.NODE_ENV !== 'production') {
92+
invariant(
93+
isValidElementType(WrappedComponent),
94+
`You must pass a component to the function returned by ` +
95+
`${methodName}. Instead received ${JSON.stringify(WrappedComponent)}`
96+
);
97+
}
9698

9799
const wrappedComponentName = WrappedComponent.displayName
98100
|| WrappedComponent.name

0 commit comments

Comments
 (0)