refactor: created custom hook for isMobile check

This commit is contained in:
Mehak Nasir
2021-07-19 20:51:39 +05:00
committed by Mehak Nasir
parent e80bd4a3b5
commit fdeccc5f2f
8 changed files with 6126 additions and 1208 deletions

View File

@@ -1,6 +1,10 @@
const executeThunk = async (thunk, dispatch, getState) => {
import { useMediaQuery } from 'react-responsive';
export const executeThunk = async (thunk, dispatch, getState) => {
await thunk(dispatch, getState);
await new Promise(setImmediate);
};
export default executeThunk;
export function useIsMobile() {
return useMediaQuery({ query: '(max-width: 768px)' });
}