diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-08-17 08:40:49 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-08-17 08:40:49 +0200 |
| commit | 74513ae9b55dee133f1cfda1fcbaf080cff934b1 (patch) | |
| tree | 60febe3949b798ce120a256ed38bf15d2669152a /gui/src | |
| parent | 6bcea0fd559988f94962bb23c159ba1b211b17bd (diff) | |
| download | mullvadvpn-74513ae9b55dee133f1cfda1fcbaf080cff934b1.tar.xz mullvadvpn-74513ae9b55dee133f1cfda1fcbaf080cff934b1.zip | |
Implement useSelector wrapper with built-in type
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/renderer/redux/store.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gui/src/renderer/redux/store.ts b/gui/src/renderer/redux/store.ts index 3579978425..79700497c6 100644 --- a/gui/src/renderer/redux/store.ts +++ b/gui/src/renderer/redux/store.ts @@ -1,3 +1,4 @@ +import { useSelector as useReduxSelector } from 'react-redux'; import { combineReducers, compose, createStore, Dispatch } from 'redux'; import accountActions, { AccountAction } from './account/actions'; @@ -62,3 +63,7 @@ function composeEnhancers(): typeof compose { (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ actionCreators })() : compose(); } + +export function useSelector<R>(fn: (state: IReduxState) => R): R { + return useReduxSelector(fn); +} |
