Skip to content

Commit

Permalink
Show useSelector result in React DevTools (reduxjs#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
Finesse committed Feb 27, 2020
1 parent 24de6e9 commit e6719b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hooks/useSelector.js
@@ -1,4 +1,4 @@
import { useReducer, useRef, useMemo, useContext } from 'react'
import { useReducer, useRef, useMemo, useContext, useDebugValue } from 'react'
import { useReduxContext as useDefaultReduxContext } from './useReduxContext'
import Subscription from '../utils/Subscription'
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
Expand Down Expand Up @@ -97,12 +97,16 @@ export function createSelectorHook(context = ReactReduxContext) {
}
const { store, subscription: contextSub } = useReduxContext()

return useSelectorWithStoreAndSubscription(
const selectedState = useSelectorWithStoreAndSubscription(
selector,
equalityFn,
store,
contextSub
)

useDebugValue(selectedState)

return selectedState
}
}

Expand Down

0 comments on commit e6719b4

Please sign in to comment.