From d5d4b0a1fc1453c94d2f5b76c8f3f71ab9e4e188 Mon Sep 17 00:00:00 2001 From: speakingcode Date: Tue, 26 Jan 2021 03:16:31 -0600 Subject: [PATCH] Use useIsomorphicLayoutEffect in Provider for consistency --- src/components/Provider.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Provider.js b/src/components/Provider.js index 1e7422656..fdfc48b75 100644 --- a/src/components/Provider.js +++ b/src/components/Provider.js @@ -1,7 +1,8 @@ -import React, { useMemo, useEffect } from 'react' +import React, { useMemo } from 'react' import PropTypes from 'prop-types' import { ReactReduxContext } from './Context' import Subscription from '../utils/Subscription' +import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect' function Provider({ store, context, children }) { const contextValue = useMemo(() => { @@ -15,7 +16,7 @@ function Provider({ store, context, children }) { const previousState = useMemo(() => store.getState(), [store]) - useEffect(() => { + useIsomorphicLayoutEffect(() => { const { subscription } = contextValue subscription.trySubscribe()