11/* eslint-disable valid-jsdoc, @typescript-eslint/no-unused-vars */
22import hoistStatics from 'hoist-non-react-statics'
33import type { ComponentType } from 'react'
4- import React , { useContext , useMemo , useRef } from 'react'
4+ import * as React from 'react'
55import { isValidElementType , isContextConsumer } from 'react-is'
66
77import type { Store } from 'redux'
@@ -533,15 +533,15 @@ function connect<
533533 props : InternalConnectProps & TOwnProps
534534 ) {
535535 const [ propsContext , reactReduxForwardedRef , wrapperProps ] =
536- useMemo ( ( ) => {
536+ React . useMemo ( ( ) => {
537537 // Distinguish between actual "data" props that were passed to the wrapper component,
538538 // and values needed to control behavior (forwarded refs, alternate context instances).
539539 // To maintain the wrapperProps object reference, memoize this destructuring.
540540 const { reactReduxForwardedRef, ...wrapperProps } = props
541541 return [ props . context , reactReduxForwardedRef , wrapperProps ]
542542 } , [ props ] )
543543
544- const ContextToUse : ReactReduxContextInstance = useMemo ( ( ) => {
544+ const ContextToUse : ReactReduxContextInstance = React . useMemo ( ( ) => {
545545 // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.
546546 // Memoize the check that determines which context instance we should use.
547547 return propsContext &&
@@ -553,7 +553,7 @@ function connect<
553553 } , [ propsContext , Context ] )
554554
555555 // Retrieve the store and ancestor subscription via context, if available
556- const contextValue = useContext ( ContextToUse )
556+ const contextValue = React . useContext ( ContextToUse )
557557
558558 // The store _must_ exist as either a prop or in context.
559559 // We'll check to see if it _looks_ like a Redux store first.
@@ -587,13 +587,13 @@ function connect<
587587 ? contextValue . getServerState
588588 : store . getState
589589
590- const childPropsSelector = useMemo ( ( ) => {
590+ const childPropsSelector = React . useMemo ( ( ) => {
591591 // The child props selector needs the store reference as an input.
592592 // Re-create this selector whenever the store changes.
593593 return defaultSelectorFactory ( store . dispatch , selectorFactoryOptions )
594594 } , [ store ] )
595595
596- const [ subscription , notifyNestedSubs ] = useMemo ( ( ) => {
596+ const [ subscription , notifyNestedSubs ] = React . useMemo ( ( ) => {
597597 if ( ! shouldHandleStateChanges ) return NO_SUBSCRIPTION_ARRAY
598598
599599 // This Subscription's source should match where store came from: props vs. context. A component
@@ -615,7 +615,7 @@ function connect<
615615
616616 // Determine what {store, subscription} value should be put into nested context, if necessary,
617617 // and memoize that value to avoid unnecessary context updates.
618- const overriddenContextValue = useMemo ( ( ) => {
618+ const overriddenContextValue = React . useMemo ( ( ) => {
619619 if ( didStoreComeFromProps ) {
620620 // This component is directly subscribed to a store from props.
621621 // We don't want descendants reading from this store - pass down whatever
@@ -632,14 +632,14 @@ function connect<
632632 } , [ didStoreComeFromProps , contextValue , subscription ] )
633633
634634 // Set up refs to coordinate values between the subscription effect and the render logic
635- const lastChildProps = useRef < unknown > ( )
636- const lastWrapperProps = useRef ( wrapperProps )
637- const childPropsFromStoreUpdate = useRef < unknown > ( )
638- const renderIsScheduled = useRef ( false )
639- const isProcessingDispatch = useRef ( false )
640- const isMounted = useRef ( false )
635+ const lastChildProps = React . useRef < unknown > ( )
636+ const lastWrapperProps = React . useRef ( wrapperProps )
637+ const childPropsFromStoreUpdate = React . useRef < unknown > ( )
638+ const renderIsScheduled = React . useRef ( false )
639+ const isProcessingDispatch = React . useRef ( false )
640+ const isMounted = React . useRef ( false )
641641
642- const latestSubscriptionCallbackError = useRef < Error > ( )
642+ const latestSubscriptionCallbackError = React . useRef < Error > ( )
643643
644644 useIsomorphicLayoutEffect ( ( ) => {
645645 isMounted . current = true
@@ -648,7 +648,7 @@ function connect<
648648 }
649649 } , [ ] )
650650
651- const actualChildPropsSelector = useMemo ( ( ) => {
651+ const actualChildPropsSelector = React . useMemo ( ( ) => {
652652 const selector = ( ) => {
653653 // Tricky logic here:
654654 // - This render may have been triggered by a Redux store update that produced new child props
@@ -676,7 +676,7 @@ function connect<
676676 // about useLayoutEffect in SSR, so we try to detect environment and fall back to
677677 // just useEffect instead to avoid the warning, since neither will run anyway.
678678
679- const subscribeForReact = useMemo ( ( ) => {
679+ const subscribeForReact = React . useMemo ( ( ) => {
680680 const subscribe = ( reactListener : ( ) => void ) => {
681681 if ( ! subscription ) {
682682 return ( ) => { }
@@ -741,7 +741,7 @@ function connect<
741741
742742 // Now that all that's done, we can finally try to actually render the child component.
743743 // We memoize the elements for the rendered child component as an optimization.
744- const renderedWrappedComponent = useMemo ( ( ) => {
744+ const renderedWrappedComponent = React . useMemo ( ( ) => {
745745 return (
746746 // @ts -ignore
747747 < WrappedComponent
@@ -753,7 +753,7 @@ function connect<
753753
754754 // If React sees the exact same element reference as last time, it bails out of re-rendering
755755 // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.
756- const renderedChild = useMemo ( ( ) => {
756+ const renderedChild = React . useMemo ( ( ) => {
757757 if ( shouldHandleStateChanges ) {
758758 // If this component is subscribed to store updates, we need to pass its own
759759 // subscription instance down to our descendants. That means rendering the same
0 commit comments