Skip to content

Commit

Permalink
only running isValidElementType in development builds (#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 7458311 commit 0e44ad1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
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 0e44ad1

Please sign in to comment.