Skip to content

Function: getAction() ​

Call Signature ​

getAction<Type>(type): Action<void, Type>

Defined in: src/lib/actions/get-action.function.ts:16

getAction is a function that takes in an action Type and optionally Payload and creates an Action object.

Example: Creating an action with a payload ​

typescript
import { getAction } from '@state-adapt/core';

const action = getAction('ADD', 1);

// action = { type: 'ADD', payload: 1 }

Type Parameters ​

Type ​

Type extends string

Parameters ​

type ​

Type

Returns ​

Action<void, Type>

Call Signature ​

getAction<Type, Payload>(type, payload): Action<Payload, Type>

Defined in: src/lib/actions/get-action.function.ts:17

getAction is a function that takes in an action Type and optionally Payload and creates an Action object.

Example: Creating an action with a payload ​

typescript
import { getAction } from '@state-adapt/core';

const action = getAction('ADD', 1);

// action = { type: 'ADD', payload: 1 }

Type Parameters ​

Type ​

Type extends string

Payload ​

Payload

Parameters ​

type ​

Type

payload ​

Payload

Returns ​

Action<Payload, Type>