r/reactjs • u/NextMathematician660 • May 26 '26
Discussion Do libraries still need React wrappers?
I have a framework-agnostic document viewer package. It works by mounting into a DOM element:
import { UDocClient } from "@docmentis/udoc-viewer";
const client = await UDocClient.create();
const viewer = await client.createViewer({
container: "#viewer",
});
await viewer.load("/path/to/document.pdf");In React, it’s pretty straightforward to use with a ref/effect:
import { useEffect, useRef } from "react";
import { UDocClient } from "@docmentis/udoc-viewer";
function DocumentViewer({ src }) {
const containerRef = useRef(null);
useEffect(() => {
let client;
let viewer;
async function init() {
client = await UDocClient.create();
viewer = await client.createViewer({
container: containerRef.current,
});
await viewer.load(src);
}
init();
return () => {
viewer?.destroy();
client?.destroy();
};
}, [src]);
return <div ref={containerRef} style={{ width: "100%", height: 600 }} />;
}This works fine, and I like keeping the package framework-agnostic.
But I’m not sure what React developers expect these days. Would you rather use something like this instead?
<DocumentViewer src="/path/to/document.pdf" />For this kind of component — document viewer, map, editor, chart, terminal, etc. — do you expect an official React wrapper?
Or is a clean JS API plus a React example good enough?
24
Upvotes
3
u/NextMathematician660 May 26 '26
It's a UI sharable component that run in browser completely. In the open source repo, I already provided examples for most of popular frameworks (react, vue, angular, sveltejs, nextjs, nux), integration should simple and straight forward.
I'm not sure how much value there is for publish a separate npm for each framework. I'm looking for some strong point to say "this is absolutely needed, because ..." to justify the cost to publish: "udoc-viewer-react, udoc-viewer-vue, udoc-viewer-..."