Skip to content

Commit f4262b8

Browse files
authored
Use react-is checks
1 parent 5befe04 commit f4262b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/connectAdvanced.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import hoistStatics from 'hoist-non-react-statics'
22
import invariant from 'invariant'
33
import React, { Component, PureComponent } from 'react'
4-
import { isValidElementType } from 'react-is'
4+
import {
5+
isValidElementType,
6+
isContextConsumer,
7+
isContextProvider
8+
} from 'react-is'
59

610
import { ReactReduxContext } from './Context'
711

@@ -215,8 +219,8 @@ export default function connectAdvanced(
215219
render() {
216220
const ContextToUse =
217221
this.props.context &&
218-
this.props.context.Provider &&
219-
this.props.context.Consumer
222+
isContextProvider(this.props.context.Provider) &&
223+
isContextConsumer(this.props.context.Consumer)
220224
? this.props.context
221225
: Context
222226

0 commit comments

Comments
 (0)