Skip to content

Commit 746f9e3

Browse files
committed
Show useSelector result in React DevTools
1 parent 043517e commit 746f9e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/hooks/useSelector.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useReducer, useRef, useMemo, useContext } from 'react'
1+
import { useReducer, useRef, useMemo, useContext, useDebugValue } from 'react'
22
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'
33
import Subscription from '../utils/Subscription'
44
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
@@ -97,12 +97,16 @@ export function createSelectorHook(context = ReactReduxContext) {
9797
}
9898
const { store, subscription: contextSub } = useReduxContext()
9999

100-
return useSelectorWithStoreAndSubscription(
100+
const selectedState = useSelectorWithStoreAndSubscription(
101101
selector,
102102
equalityFn,
103103
store,
104104
contextSub
105105
)
106+
107+
useDebugValue(selectedState)
108+
109+
return selectedState
106110
}
107111
}
108112

0 commit comments

Comments
 (0)