react document viewer

Solutions on MaxInterview for react document viewer by the best coders in the world

showing results for - "react document viewer"
Salomé
19 Mar 2020
1// MyApp.js
2import React, { Component } from 'react';
3import logger from 'logging-library';
4import FileViewer from 'react-file-viewer';
5import { CustomErrorComponent } from 'custom-error';
6
7const file = 'http://example.com/image.png'
8const type = 'png'
9
10class MyComponent extends Component {
11  render() {
12    return (
13      <FileViewer
14        fileType={type}
15        filePath={file}
16        errorComponent={CustomErrorComponent}
17        onError={this.onError}/>
18    );
19  }
20
21  onError(e) {
22    logger.logError(e, 'error in file-viewer');
23  }
24}
25