# Passing callback functions while registering react components in builder

**URL:** <https://forum.builder.io/t/passing-callback-functions-while-registering-react-components-in-builder/1873>\
**Category:** Technical Questions\
**Created:** [March 7, 2022, 5:47pm UTC](https://forum.builder.io/t/passing-callback-functions-while-registering-react-components-in-builder/1873 "2022-03-07T17:47:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![will](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@will](https://forum.builder.io/u/will)\
**Post date:** [March 8, 2022, 8:03pm UTC](https://forum.builder.io/t/passing-callback-functions-while-registering-react-components-in-builder/1873/3 "2022-03-08T20:03:24Z")

</div>

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.

```auto
<BuilderComponent
   model={Builder.previewingModel || 'builder-page'}
   context={{
       callbackFn,
   }} />

```

Then, in your custom component, you can access these via the `builderState` prop that is passed.

```auto
function CustomComponent(props) {
  const onClick = () => {
    props.builderState.context.callbackFn();
  }
  return (
     <button onClick={onClick}>custom button</button>
  )
}

```

---

_[View the full topic](https://forum.builder.io/t/passing-callback-functions-while-registering-react-components-in-builder/1873)._
