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); }; |