优化
This commit is contained in:
15
client/shared/redux/hooks/useAppSelector.ts
Normal file
15
client/shared/redux/hooks/useAppSelector.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { AppState } from '../slices';
|
||||
import { useSelector, useDispatch, useStore } from 'react-redux';
|
||||
|
||||
export function useAppSelector<T>(
|
||||
selector: (state: AppState) => T,
|
||||
equalityFn?: (left: T, right: T) => boolean
|
||||
) {
|
||||
return useSelector<AppState, T>(selector, equalityFn);
|
||||
}
|
||||
|
||||
export const useAppDispatch = useDispatch;
|
||||
|
||||
export function useAppStore<AppState>() {
|
||||
return useStore<AppState>();
|
||||
}
|
||||
Reference in New Issue
Block a user