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

Action

出典: Typescript×Reduxでカウンタアプリ作ってみる!各ソースコード / Action

Action (sql)#471a1378c67a
import {Action} from 'redux'



export enum    ActionNames{

   Increment = 'inc',

   Decrement = 'dec'

}



export interface IIncrement extends Action{

   type : ActionNames.Increment

}



export interface IDecrement extends Action {

   type : ActionNames.Decrement;

}



// 名前は何でもいい。IncrementでもIncでも。なんでも。

// 戻り値は上で定義したInterfaceを返すようにする。

// いわばActionCreatorといわれるやつ。

export const IncrementAmount = () : IIncrement => ({type : ActionNames.Increment});

export const DecrementAmount = () : IDecrement => ({type : ActionNames.Decrement});



export type ActionType = IIncrement | IDecrement;

▸ この snippet は実行結果未収録
▸ 実行結果は未収録です
  • id: #471a1378c67a
  • lines: 22
  • extracted: 2026-06-10

Source収録記事

この snippet は記事の「各ソースコード / Action」セクションに登場する。コードの前後の文脈・ハマりどころの解説は記事本文で。

同じ記事から

5
図鑑トップ