動くコード図鑑技術記事現場の渡り方キャリア論すべての記事About
TypeScript

connectのタイミングでundefinedなら?

出典: Typescript×ReduxでStateがundefinedに?確認すること!ContainerのMapstateの部分でどのような値が来てるか見てみる。 / connectのタイミングでundefinedなら?

connectのタイミングでundefinedなら? (typescript)#3c47d076fe68
const CounterReducer = (state : IState = initialState , action : ActionType): IState => {
	switch (action.type) {
		case ActionNames.Increment:
			return {num : state.num + 1};
		case ActionNames.Decrement:
			return {num : state.num - 1};
		// default:
		// 	return state;
	}
};
▸ この snippet は実行結果未収録
▸ 実行結果は未収録です
  • id: #3c47d076fe68
  • lines: 10
  • extracted: 2026-06-10

Source収録記事

この snippet は記事の「ContainerのMapstateの部分でどのような値が来てるか見てみる。 / connectのタイミングでundefinedなら?」セクションに登場する。コードの前後の文脈・ハマりどころの解説は記事本文で。

同じ記事から

12
図鑑トップ