Skip to content

Commit

Permalink
Use useIsomorphicLayoutEffect in Provider for consistency (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
speakingcode committed Mar 22, 2021
1 parent 86b6fe0 commit 3aa8993
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions 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(() => {
Expand All @@ -15,7 +16,7 @@ function Provider({ store, context, children }) {

const previousState = useMemo(() => store.getState(), [store])

useEffect(() => {
useIsomorphicLayoutEffect(() => {
const { subscription } = contextValue
subscription.trySubscribe()

Expand Down

0 comments on commit 3aa8993

Please sign in to comment.