MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / ctxToEnumControlProps

Function ctxToEnumControlProps

packages/react/src/JsonFormsContext.tsx:301–318  ·  view source on GitHub ↗
(
  ctx: JsonFormsStateContext,
  props: OwnPropsOfEnum
)

Source from the content-addressed store, hash-verified

299) => mapStateToControlProps({ jsonforms: { ...ctx } }, props);
300
301export const ctxToEnumControlProps = (
302 ctx: JsonFormsStateContext,
303 props: OwnPropsOfEnum
304) => {
305 const enumProps = mapStateToEnumControlProps(
306 { jsonforms: { ...ctx } },
307 props
308 );
309 /**
310 * Make sure, that options are memoized as otherwise the component will rerender for every change,
311 * as the options array is recreated every time.
312 */
313 const options = useMemo(
314 () => enumProps.options,
315 [props.options, enumProps.schema, ctx.i18n?.translate]
316 );
317 return { ...enumProps, options };
318};
319
320export const ctxToOneOfEnumControlProps = (
321 ctx: JsonFormsStateContext,

Callers 1

withContextToEnumPropsFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…