Skip to content

Instantly share code, notes, and snippets.

@sendbird-community
Created December 3, 2022 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sendbird-community/abf771df53115f71c10edbf85accc14c to your computer and use it in GitHub Desktop.
Save sendbird-community/abf771df53115f71c10edbf85accc14c to your computer and use it in GitHub Desktop.
How to implement the Channel module using the ChannelProvider and useChannelContext
import Channel from '@sendbird/uikit-react/Channel';
import { ChannelProvider, useChannelContext } from '@sendbird/uikit-react/Channel/context';
const MyComponent = () => {
const channelState = useChannelContext();
return (
...render custom component
);
};
<ChannelProvider>
<MyComponent />
<ChannelProvider/>
const CheckMessageText = () => {
const channelState = useChannelContext();
return (
...render custom component
);
};
<Channel
onBeforeSendUserMessage={CheckMessageText}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment