Calling a Renderer inside another Renderer

Hi,

How can I call a renderer inside a different renderer?

A more concrete example.

In languagesRenderer, I list some languages, and below that I have a dialog component where there is a form to add or edit foods. That form is a combination of different dropdowns. And for proper validation, I would like to use my object renderer. How would I go about calling the object renderer so that it can render my form?

If you need I can send the code for both renderers.

Thanks in advance

Hi @adamsilva01,

In JSON Forms you can dispatch to other renderers via the DispatchRenderer. This is typically used to dispatch to children UI Schema elements.

If a custom renderer is dependent on another property than just “its own” then it can access the form-wide store to retrieve all the data it needs. I would advise against any direct communication between renderers as this breaks encapsulation.

To access the form wide store you can use const jsonforms = useJsonForms() and then for example access the form wide data with jsonforms.core.data.