Skip to content

Commit 3aa8993

Browse files
authoredMar 22, 2021
Use useIsomorphicLayoutEffect in Provider for consistency (#1683)
1 parent 86b6fe0 commit 3aa8993

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/components/Provider.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useMemo, useEffect } from 'react'
1+
import React, { useMemo } from 'react'
22
import PropTypes from 'prop-types'
33
import { ReactReduxContext } from './Context'
44
import Subscription from '../utils/Subscription'
5+
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
56

67
function Provider({ store, context, children }) {
78
const contextValue = useMemo(() => {
@@ -15,7 +16,7 @@ function Provider({ store, context, children }) {
1516

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

18-
useEffect(() => {
19+
useIsomorphicLayoutEffect(() => {
1920
const { subscription } = contextValue
2021
subscription.trySubscribe()
2122

0 commit comments

Comments
 (0)
Please sign in to comment.