# How to access the button information in registered custom react component from Builder and pass the onclick callback of the button from builder?

**URL:** <https://forum.builder.io/t/how-to-access-the-button-information-in-registered-custom-react-component-from-builder-and-pass-the-onclick-callback-of-the-button-from-builder/1864>\
**Category:** Technical Questions\
**Created:** [March 4, 2022, 6:11pm UTC](https://forum.builder.io/t/how-to-access-the-button-information-in-registered-custom-react-component-from-builder-and-pass-the-onclick-callback-of-the-button-from-builder/1864 "2022-03-04T18:11:26Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![TimG](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/timg/32/714_2.png) [@TimG](https://forum.builder.io/u/TimG)\
**Post date:** [March 8, 2022, 10:56pm UTC](https://forum.builder.io/t/how-to-access-the-button-information-in-registered-custom-react-component-from-builder-and-pass-the-onclick-callback-of-the-button-from-builder/1864/5 "2022-03-08T22:56:35Z")

</div>

Hi @dharmaraju understood, I see you started another thread here:

> [@Passing callback functions while registering react components in builder](https://forum.builder.io/t/passing-callback-functions-while-registering-react-components-in-builder/1873/3):
>
> hey TimG and @dharmaraju - I was just working on integrating this in our NextJS codebase, maybe I can share how we are utilizing functions and React context. \<BuilderComponent model={Builder.previewingModel || 'builder-page'} context={{ callbackFn, }} /\> Then, in your custom component, you can access these via the builderState prop that is passed. function CustomComponent(props) { const onClick = () =\> { props.builderState.context.callbackFn(); } return ( \<butto…

Let me know if there is anything I missed otherwise we can continue the conversation there!

---

_[View the full topic](https://forum.builder.io/t/how-to-access-the-button-information-in-registered-custom-react-component-from-builder-and-pass-the-onclick-callback-of-the-button-from-builder/1864)._
