# Reactions

## Overview

You can react to both activities and comments. It's possible to configure any reaction types that best fit your app.

<codetabs>

<codetabs-item value="swift" label="Swift">

```swift
// Add a reaction to an activity
let reaction = try await feed.addReaction(
    activityId: "activity_123",
    request: .init(
        custom: ["emoji": "❤️"],
        type: "like"
    )
)
// Remove a reaction
_ = try await feed.deleteReaction(activityId: "activity_123", type: "like")
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const addResponse = await client.addReaction({
  activity_id: "activity_123",
  type: "like",
  custom: {
    emoji: "❤️",
  },
});

console.log(addResponse.reaction);

const deleteResponse = await client.deleteActivityReaction({
  activity_id: "activity_123",
  type: "like",
});

console.log(deleteResponse.reaction);
```

</codetabs-item>

<codetabs-item value="nodejs" label="Node">

```js
const addResponse = await client.feeds.addReaction({
  activity_id: "activity_123",
  type: "like",
  custom: {
    emoji: "❤️",
  },
  user_id: "reacting_user_id",
});

console.log(addResponse.reaction);

const deleteResponse = await client.feeds.deleteActivityReaction({
  activity_id: "activity_123",
  type: "like",
  user_id: "reacting_user_id",
});

console.log(deleteResponse.reaction);
```

</codetabs-item>

<codetabs-item value="go-golang" label="Go">

```go
package main

import (
    "context"
    "log"

    "github.com/GetStream/getstream-go/v3"
)

func main() {
    client, err := getstream.NewClient("<your_api_key>", "<your_api_secret>")
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    feedsClient := client.Feeds()

    // Add a reaction to an activity
    addResponse, err := feedsClient.AddReaction(ctx, "activity_123", &getstream.AddReactionRequest{
        Type: "like",
        Custom: map[string]interface{}{
            "emoji": "❤️",
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("Reaction added: %+v", addResponse.Data)

    // Remove a reaction
    deleteResponse, err := feedsClient.DeleteActivityReaction(ctx, "activity_123", "like", &getstream.DeleteActivityReactionRequest{})
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("Reaction deleted: %+v", deleteResponse.Data)
}
```

</codetabs-item>

</codetabs>

By default creating a reaction doesn't create an activity.

When you read a feed the reactions are included. Here's an example:

<codetabs>

<codetabs-item value="swift" label="Swift">

```swift
let feedData = try await feed.getOrCreate()
// Last 15 reactions on the first activity
print(feed.state.activities[0].latestReactions)
// Count of reactions by type
print(feed.state.activities[0].reactionGroups)
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const feed = client.feed("user", "sara");
await feed.getOrCreate();

console.log(feed.state.getLatestValue().activities?.[0].own_reactions);
console.log(feed.state.getLatestValue().activities?.[0].latest_reactions);
console.log(feed.state.getLatestValue().activities?.[0].reaction_groups);
```

</codetabs-item>

<codetabs-item value="nodejs" label="Node">

```js
const feed = client.feeds.feed("user", "sara");
const response = await feed.getOrCreate({ user_id: "sara" });

console.log(response.activities[0].own_reactions);
console.log(response.activities[0].latest_reactions);
console.log(response.activities[0].reaction_groups);
```

</codetabs-item>

<codetabs-item value="go-golang" label="Go">

```go
package main

import (
    "context"
    "log"

    "github.com/GetStream/getstream-go/v3"
)

func main() {
    client, err := getstream.NewClient("<your_api_key>", "<your_api_secret>")
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    feedsClient := client.Feeds()

    // Read feed with reactions included
    feed := feedsClient.Feed("user", "sara")
    response, err := feed.GetOrCreate(ctx, &getstream.GetOrCreateFeedRequest{
        UserID: getstream.PtrTo("sara"),
    })
    if err != nil {
        log.Fatal(err)
    }

    if len(response.Data.Activities) > 0 {
        activity := response.Data.Activities[0]
        log.Printf("Own reactions: %+v", activity.OwnReactions)
        log.Printf("Latest reactions: %+v", activity.LatestReactions)
        log.Printf("Reaction groups: %+v", activity.ReactionGroups)
    }
}
```

</codetabs-item>

</codetabs>

---

This page was last updated at 2025-08-15T14:14:10.474Z.

For the most recent version of this documentation, visit [https://getstream.io/activity-feeds/docs/react-native/reactions/](https://getstream.io/activity-feeds/docs/react-native/reactions/).