Package Exports
- react-doc-render
- react-doc-render/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-doc-render) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-doc-render
It's a lightweight React library for rendering documents of various popular MIME types directly in the browser. It supports formats such as PDF, images (JPEG, PNG, GIF), text files, and Microsoft Office documents (Word, Excel, PowerPoint), providing a simple and unified interface to handle different content types.
Installation
npm install react-doc-render
Usage
- Import
import { DocRender } from 'react-doc-render'
- Add to render section
<DocRender uri={uri} />
Configuration
const MyCustomLoadingComponent: React.FC = () => {
return (
<>Custom loading...</>
)
}
const myCustomJPGRenderer = () => {
console.log('hello myCustomJPGRenderer!')
}
const config = {
loading: MyCustomLoadingComponent,
renderers: {
'jpg': myCustomJPGRenderer,
}
}
<DocRender uri={uri} config={config} />