Skip to content

Commit

Permalink
only running isValidElementType in development builds (reduxjs#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon authored and timdorr committed Nov 1, 2018
1 parent cdf967b commit 92a0faa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/connectAdvanced.js
Expand Up @@ -88,11 +88,13 @@ export default function connectAdvanced(
}

return function wrapWithConnect(WrappedComponent) {
invariant(
isValidElementType(WrappedComponent),
`You must pass a component to the function returned by ` +
`${methodName}. Instead received ${JSON.stringify(WrappedComponent)}`
)
if (process.env.NODE_ENV !== 'production') {
invariant(
isValidElementType(WrappedComponent),
`You must pass a component to the function returned by ` +
`${methodName}. Instead received ${JSON.stringify(WrappedComponent)}`
);
}

const wrappedComponentName = WrappedComponent.displayName
|| WrappedComponent.name
Expand Down

0 comments on commit 92a0faa

Please sign in to comment.