I have tried to run the following code but I have not managed to read the PDF with the Reaction CLI, I hope you can help me, I leave the information:
import React, { Component } from 'react';
import { Document, Page } from 'react-pdf';
// import 'react-pdf/dist/Page/AnnotationLayer.css';
class Pdf extends Component {
state = {
numPages: null,
pageNumber: 1,
file: '../../public/test.pdf'
}
onDocumentLoadSuccess = ({ numPages }) => {
this.setState({ numPages });
}
render() {
const { pageNumber, numPages, file } = this.state;
return (
<Document
file={file}
/>
);
}
}
export default Pdf;
This is my package.json:
{
"name": "leer-pdf",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-pdf": "3.0.5",
"react-scripts": "1.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"copy-webpack-plugin": "^4.5.2"
}
}
What brings me out on the page and the network
The error it generates: