---
source_url: https://www.pubnub.com/docs/sdks/redux/using
title: Using the Redux SDK
updated_at: 2026-06-22T14:40:50.348Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Using the Redux SDK

To prepare your app to use the PubNub Redux framework, you will need to implement the following items. These instructions are non-prescriptive, to help you be free to follow your own app development process.

## Configure the Store

A Redux application manages all application state in a centralized location called the **store**. To gain the benefits offered by the PubNub Redux framework, you must configure your store to include references to the PubNub libraries.

### Create the PubNub instance

```javascript
let pubnub = new Pubnub({
  publishKey: "myPublishKey",
  subscribeKey: "mySubscribeKey"
});
```

### Configure reducers

```javascript
let rootReducer = combineReducers(
  createNetworkStatusReducer(false),
  createMessageReducer(),
  createPresenceReducer(),
  createUserDataReducer(),
  createChannelDataReducer(),
  createMembershipReducer(),
  createChannelMembersReducer(),
);
```

### Configure redux thunk middleware

The PubNub Redux framework uses Redux Thunk to manage the interaction with commands that execute PubNub API calls, process the responses, and dispatch Redux actions.

```javascript
let thunkArgument = {
  pubnub: {
    api: pubnub
  }
};

let middleware = applyMiddleware(ReduxThunk.withExtraArgument(thunkArgument));
```

### Complete the Store configuration

```javascript
let myStore = createStore(
  rootReducer,
  undefined,
  middleware,
);
```

## Register listeners

You can register all the listeners that are included in the PubNub Redux framework.

```javascript
pubnub.addListener(createPubnubListener(store.dispatch));
```

You can also choose to register only specific listeners and combine with other listeners in your application.

```javascript
pubnub.addListener(
  combineListeners(
    createNetworkStatusListener(store.dispatch),
    createMessageListener(store.dispatch),
    createPresenceListener(store.dispatch),
    // a custom listener
    {
      status: (status) => {
        console.log(status)
      }
    }
  )
);
```