# EventDefinition

A `function` that you provide to Redux Beacon for each Redux or ngrx/store action you want to track.

## Syntax

```javascript
function eventDef(action, prevState, nextState) {
  // Return:
  //   - an event object, or
  //   - an array of event objects, or
  //   - a Promise that resolves to an event object, or
  //   - a Promise that resolves to an array of event objects
}
```

### Parameters

* Redux Beacon calls every event definition with three arguments:
  * `action`: The action object.
  * `prevState`: The state before the action.
  * `nextState`: The state after the action.

## Typescript Type

```typescript
import { EventDefinition } from 'redux-beacon';
```

## Usage

* [Getting Started](/redux-beacon/getting-started-redux-users.md)
* [Examples & Recipes](https://github.com/rangle/redux-beacon/tree/323d6a6613ac06fe4c7cc69f80ef9d5cce587b7b/docs/recipes/index.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rangle.gitbook.io/redux-beacon/index-1/event-definition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
