Adding new properties to config object of JsonFormsContext

Hi Team/@sdirix ,

I want to add some properties to config object of JsonformsContext for some cases, since config is of type “any”, Is there any way to do this?

Example: I have made “Group” layout as custom renderer, where user can expand/collapse the group. I want to keep track of expanded groups. To do this I need to store the expanded Group ids somewhere in jsonFormsContext.
Not only for this case, I want to store some other values to JsonFormsContext.

Kindly let me know if there is any way to add new values to JsonFormsContext’s cofig object or need to maintain separate context which will wrap the jsonforms.
Looking forward for any solution.

Thanks in Advance!

1 Like

Hi @Suseendhiran,

Generally speaking there is no straightforward way to directly manipulate the form-wide state besides using a middleware.

However usually that is not necessary. The typical approach for injecting or sharing state with and between renderers is to use an own React context. Within that context you can easily maintain the current group state.