# Sendbird UIKit: subscribe for new messages for user?

**URL:** <https://community.sendbird.com/t/sendbird-uikit-subscribe-for-new-messages-for-user/700>\
**Category:** React\
**Created:** [July 27, 2020, 11:30pm UTC](https://community.sendbird.com/t/sendbird-uikit-subscribe-for-new-messages-for-user/700 "2020-07-27T23:30:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Sravan\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/sravan_s/32/83_2.png) [@Sravan\_S](https://community.sendbird.com/u/Sravan_S)\
**Post date:** [July 28, 2020, 1:54am UTC](https://community.sendbird.com/t/sendbird-uikit-subscribe-for-new-messages-for-user/700/2 "2020-07-28T01:54:19Z")

</div>

Hi @Dmytro

Apologies about the docs - we understand that docs are the most important part of any library - we are working on improving them. As a first step, we have made a bunch of examples on various use cases for UIKit. You can find them here

> **[sendbird/SendBird-JavaScript](https://github.com/sendbird/SendBird-JavaScript/tree/master/uikit-samples)**
>
> SendBird JavaScript Sample. Please visit https://community.sendbird.com for any questions! - sendbird/SendBird-JavaScript

I recommend you to follow the pattern from [https://github.com/sendbird/SendBird-JavaScript/tree/master/uikit-samples#2-5-customizing-messageinput](https://github.com/sendbird/SendBird-JavaScript/tree/master/uikit-samples#2-5-customizing-messageinput)

Using withSendBird HOC to access SDK to your custom component  
And from there, use the SDK instance and use [event handlers](https://docs.sendbird.com/javascript/event_handler) to listen to events

```auto

import React, { useEffect } from "react";
import { sendBirdSelectors, withSendBird } from "sendbird-uikit";

const CustomComponent = (props) => {
  const {sdk} = props;
  useEffect(() => {
    var ChannelHandler = new sb.ChannelHandler();
    ChannelHandler.onMessageReceived = function(channel, message) {
      // your custom logic
    };
    sb.addChannelHandler(UNIQUE_HANDLER_ID, ChannelHandler);
    return () => {
      // cleanup
      sb.removeChannelHandler(UNIQUE_HANDLER_ID);
    }
  }, [sdk])
  return (
    <div />
  )
}

const mapStoreToProps = store => {
  const sdk = sendBirdSelectors.getSdk(store);
  return {
    sdk,
  };
};

export default withSendBird(CustomComponent, mapStoreToProps);

```

^^ If this didnt help, please let me know

---

_[View the full topic](https://community.sendbird.com/t/sendbird-uikit-subscribe-for-new-messages-for-user/700)._
