UNPKG

document-viewer-ts

Version:

PDF and MS Doc viewer written in TypeScript for React and vanilla JavaScript

13 lines 606 B
import React, { useEffect, useRef } from 'react'; import { renderDocument } from './base.js'; export const Viewer = (props) => { const viewerContainer = useRef(null); useEffect(() => { const container = viewerContainer.current; if (!container) return; return renderDocument(props.workerSrc)(container); }, [props.workerSrc, props.documentUrl, props.documentId]); return React.createElement("div", { ref: viewerContainer, className: "viewer-container", id: props.documentId, "data-document-url": props.documentUrl }); }; //# sourceMappingURL=Viewer.js.map