API Reference > ui-framework > State > createAction createAction Function Creates a basic Redux Redux Action without a payload. This is meant to be used as a shortcut for defining Action Creators. For example, () => createAction("FOO", ids) defines an action creator of type: () => { type: "FOO" } // which is equivalent to: () => Action<"FOO"> Note that the generic type parameters can always be omitted - TypeScript will be able to infer them. createAction<T extends string>(type: T): Action<T> Parameter Type Description type T The string to use as the action's type property. Should have a string literal type. Returns - Action<T> Creates a basic Redux Redux Action with a payload value. This is meant to be used as a shortcut for defining Action Creators. For example, (ids: number[]) => createAction("FOO", ids) defines an action creator of type: (ids: number[]) => { type: "FOO", payload: ReadonlyArray<number> } // which is equivalent to: (ids: number[]) => ActionWithPayload<"FOO", ReadonlyArray<number>> Note that the generic type parameters can always be omitted - TypeScript will be able to infer them. createAction<T extends string, P>(type: T, payload: P): ActionWithPayload<T, DeepReadonly<P>> Parameter Type Description type T The string to use as the action's type property. Should have a string literal type. payload P The value to use as the action's payload property. May be of any type. Returns - ActionWithPayload<T, DeepReadonly<P>> Defined in ui/framework/src/ui-framework/redux/redux-ts.ts Line 85 Last Updated: 11 June, 2024