Skip to content

Commit

Permalink
Use useIsomorphicLayoutEffect in Provider for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
speakingcode committed Jan 26, 2021
1 parent a923553 commit d5d4b0a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Provider.js
Original file line number Diff line number Diff line change
@@ -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 d5d4b0a

Please sign in to comment.