React Quick Start examples fail at runtime: Renderer must be wrapped in JSONUIProvider
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- documentation, frontend
Research direction
Read the React examples at lines 119, 188, and 280 of the root README.md, then check the Solid example at lines 231–247 for the provider pattern. Update the three React examples to wrap Renderer in JSONUIProvider, using the working version in the issue as a guide. Done when each documented React snippet includes the required provider.
Written by the indexing model from the issue text.
Description
Summary
The React Quick Start in the root README.md and the @json-render/react usage examples render <Renderer> without any provider. Copying these snippets verbatim crashes at runtime:
Error: useVisibility must be used within a VisibilityProvider
at useVisibility (...)
at ReactiveElementRenderer (...)
Where
Root README.md:
- Line 119 — React Quick Start (
Rendererin aDashboardcomponent, no provider) - Line 188 — React renderer section, "That's it" example
- Line 280 — shadcn/ui section
The Solid section (line 231–247) is the only renderer example that wraps <JSONUIProvider> correctly, which suggests this was known but never backported to the React examples.
Why it fails
Renderer calls useVisibility(), which throws unless a VisibilityProvider is above it:
throw new Error("useVisibility must be used within a VisibilityProvider");
JSONUIProvider is what supplies it. Its implementation nests the required providers:
<StateProvider>
<VisibilityProvider>
<ValidationProvider>
<ActionProvider>
<FunctionsContext.Provider>
<DirectivesContext.Provider>
{children}
<ConfirmationDialogManager />
So the provider is not optional for React — only for renderers whose README already shows it.
Reproduction
import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { defineRegistry, Renderer } from "@json-render/react";
const catalog = defineCatalog(schema, { components: { /* ... */ }, actions: {} });
const { registry } = defineRegistry(catalog, { components: { /* ... */ } });
const spec = { root: "a", elements: { a: { type: "Card", props: {}, children: [] } } };
// Exactly as documented
<Renderer spec={spec} registry={registry} />;
// -> Error: useVisibility must be used within a VisibilityProvider
Working version
import { defineRegistry, Renderer, JSONUIProvider } from "@json-render/react";
<JSONUIProvider registry={registry} initialState={spec.state ?? {}}>
<Renderer spec={spec} registry={registry} />
</JSONUIProvider>
Environment
@json-render/core0.21.3@json-render/react0.21.3@json-render/shadcn0.21.3- react / react-dom 19
- zod 4
- Vite 8, Node 26
Suggested fix
Update the three README snippets to include <JSONUIProvider>, or add a one-line note in the Quick Start that Renderer must be wrapped in a provider. A provider-missing error that names the required component (e.g. "wrap <Renderer> in <JSONUIProvider>") would also save a lot of time for newcomers.
This is not a bug report — the provider design is reasonable. The issue is that the primary React examples in the README don't work as written.
- Dominant language
- TypeScript
- Stars
- 20k
- Forks
- 1.1k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel-labs/json-render
-
shadcn Grid/Stack are not responsive (fixed grid-cols-N, no min-w-0)Possibly taken @sushanshakya77 claimed this 67 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vercel-labs/json-render#355 ·
Maintainers usually reply within 2 days
-
Array path helpers accept malformed RFC 6902 indexesPossibly taken @simonyang08 claimed this 106 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vercel-labs/json-render#326 ·
Maintainers usually reply within 2 days
-
Support zod 4.4+ — _zod.version.minor type check prevents upgradeMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vercel-labs/json-render#297 · 2 reactions ·
Maintainers usually reply within 2 days
-
feat: Generic `Spec` type supportPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
vercel-labs/json-render#275 · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
vercel-labs/json-render#260 · 6 reactions ·
Maintainers usually reply within 2 days
All issues in vercel-labs/json-render
Similar issues
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
agent/quality testing
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juspay/agent-distro#203 ·
Maintainers usually reply within 1 day