All files / src store.tsx

90% Statements 9/10
75% Branches 3/4
75% Functions 3/4
88.88% Lines 8/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23    2x   2x 2x           1x       2x 13x     2x 13x    
import { createContext, useContext } from 'react';
 
export const initialState: InitialState = {};
 
export const PointerContext = createContext<InitialState>(initialState);
export const PointerDispatchContext = createContext<Dispatch>(() => {});
 
export type Dispatch = React.Dispatch<InitialState>;
type InitialState = Record<string, number[][]>;
 
export function reducer(tasks: InitialState, action: InitialState) {
  Eif (action && Object.keys(action).length === 0) return initialState;
  return { ...tasks, ...action };
}
 
export const useStore = () => {
  return useContext(PointerContext);
};
 
export const useDispatch = () => {
  return useContext(PointerDispatchContext);
};