MCPcopy Create free account
hub / github.com/formkit/formkit / Host

Function Host

packages/react/__tests__/useFormKitContextById.spec.ts:24–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 const id = `a${token()}`
23
24 function Host() {
25 const ctx = useFormKitContextById(id)
26 return createElement(
27 'div',
28 null,
29 createElement('pre', { id: 'outer-target' }, JSON.stringify(ctx?.value)),
30 createElement(
31 FormKit as any,
32 { type: 'form', id },
33 createElement(FormKit as any, {
34 type: 'text',
35 name: 'name',
36 value: 'Mr. FormKit',
37 }),
38 createElement(ChildComponent)
39 )
40 )
41 }
42
43 const { container } = renderWithFormKit(createElement(Host), defaultConfig())
44

Callers

nothing calls this directly

Calls 2

createElementFunction · 0.90
useFormKitContextByIdFunction · 0.50

Tested by

no test coverage detected