# How to pass some data to custom control in JSON form

**URL:** <https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297>\
**Category:** General\
**Created:** [July 21, 2021, 10:18am UTC](https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297 "2021-07-21T10:18:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dijadhav](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/dijadhav/32/93_2.png) [@dijadhav](https://jsonforms.discourse.group/u/dijadhav)\
**Post date:** [July 21, 2021, 10:18am UTC](https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297/1 "2021-07-21T10:18:55Z")

</div>

Hello, I have written my one renderer, i want to pass some data to my renderer.

```auto
 const renderers = [
    ...materialRenderers,
    { tester: superConceptPathTester, renderer: BaseConceptControl }
  ];

interface BaseConcpetControlProps {
  data: any;
  filteredResources:TreeNode;
  handleChange(path: string, value: any): void;
  path: string;
}

const BaseConceptControl = ({ data, handleChange,path,filteredResources }: BaseConcpetControlProps) => (
  <BaseConcept
    value={data}
    filteredResources={filteredResources}
    updateValue={(newValue: string) => handleChange(path, newValue)}
  />
);

export default withJsonFormsControlProps(BaseConceptControl);

```

```auto

```

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 21, 2021, 11:26am UTC](https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297/2 "2021-07-21T11:26:38Z")

</div>

Hi @dijadhav, can you elaborate a bit on the problem you want to solve? I assume that the passing of `data` to your renderer works.

If you want to pass some props from outside of JSON Forms to your renderer the easiest way is to create your own React context and consume it within your renderer. Using this approach you can pass arbitrary data and callbacks to all of your JSON Forms customizations.

If you have that use case multiple times you could think of writing your own HOC and replace or combine it with `withJsonFormsControlProps` so that the renderer code itself is independent from your prop source.

---

<div class="post-metadata">

**Author:** ![dijadhav](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/dijadhav/32/93_2.png) [@dijadhav](https://jsonforms.discourse.group/u/dijadhav)\
**Post date:** [July 21, 2021, 12:21pm UTC](https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297/3 "2021-07-21T12:21:25Z")

</div>

Yes , Passing data is working fine. I want to pass more fields to my custom renderer.  
I have written custom rendered named BaseConceptControl. By default it accept 3 properties data, handleChange and path, I want to pass filteredResources also to BaseConceptControl.

How to pass it?

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 21, 2021, 1:34pm UTC](https://jsonforms.discourse.group/t/how-to-pass-some-data-to-custom-control-in-json-form/297/4 "2021-07-21T13:34:45Z")

</div>

Hi @dijadhav, as mentioned above I would recommend using a [React context](https://reactjs.org/docs/context.html) approach. You would then not define `filteredResources` as a prop but consume it from your context.
