imagineerThat
imagineerThat

Reputation: 5553

How to delete a post with the react-activity-feed client?

How does one delete a post with the react-activity-feed client for GetStream?

Upvotes: 1

Views: 321

Answers (1)

Jaap Bakker
Jaap Bakker

Reputation: 185

The StreamApp component passes a function down to the FlatFeed and the Activity component called onRemoveActivity. This is a function that takes an activity's id and removes that.

So you could do something like this to remove an activity:

<StreamApp
  apiKey=""
  appId=""
  token=""
>
  <FlatFeed
    Activity={(props) => (
      <Activity
        {...props}
        Footer={() => (
          <React.Fragment>
            <button onClick={() => props.onRemoveActivity(props.activity.id)}>
              delete
            </button>
          </React.Fragment>
        )}
      />
    )}
  />
</StreamApp>

Upvotes: 2

Related Questions