Skip to main content

ChannelActionContext

The ChannelActionContext is one of the context providers exposed in the Channel component and is consumable by all of the Channel children components. The context provides all of the action properties and handlers for a channel, and you can access these by calling the useChannelActionContext custom hook.

Basic Usage#

Pull values from context with our custom hook:

const { closeThread, loadMoreThread } = useChannelActionContext();

Values#

addNotification#

Function to add a temporary notification to MessageList, and it will be removed after 5 seconds.

Type
function

closeThread#

The function to close the currently open Thread.

Type
function

dispatch#

The dispatch function for the ChannelStateReducer.

Type
ChannelStateReducerAction

editMessage#

A function that takes a message to be edited, returns a Promise.

Type
function

loadMore#

The function to load next page/batch of messages (used for pagination).

Type
function

loadMoreThread#

The function to load next page/batch of messages in a currently active/open Thread (used for pagination).

Type
function

onMentionsClick#

Custom action handler function to execute when @mention is clicked, takes a DOM click event object and an array of mentioned users.

Type
function

onMentionsHover#

The function to execute when @mention is hovered in a message, takes a DOM click event object and an array of mentioned users.

Type
function

openThread#

The function to execute when replies count button is clicked, takes the parent message of the Thread to be opened and a DOM click event.

Type
function

removeMessage#

The function to remove a message from MessageList, handled by the Channel component. Takes a message object.

Type
function

retrySendMessage#

The function to resend a message, handled by the Channel component.

Type
function

sendMessage#

The function to send a message on Channel. Takes a message object with the basic message information as the first argument, and custom data as the second argument.

Type
function

setQuoteMessage#

The function to send a QuotedMessage on a Channel, take a message object.

Type
function

updateMessage#

The function to update a message on Channel, takes a message object.

Type
function

Did you find this page helpful?