//as const 를 붙여줘야 한다.
const SET_DIFF = "counter/SET_DIFF" as const;
const INCREASE = "coutner/INCREASE" as const;
const DECREASE = "coutner/DECREASE" as const;
// ReturnType<typeof ~> 형식으로 선언한다.
type TAction =
| ReturnType<typeof setDiff>
| ReturnType<typeof increase>
| ReturnType<typeof decrease>;
//redcer
const counter = (state = initialState, action: TAction) => {};
src / index.tsx
container / counter.tsx
useDispatch 는 리덕스 스토어의 dispatch 를 함수에서 사용 할 수 있게 해주는 Hook 입니다.