mikecousins/react-pdf-js

issue when loading the pdf. TypeError: Object(...) is not a function

Closed this issue · 2 comments

i get this error TypeError: Object(...) is not a function when trying the example. Below is my code. Can you explain whats wrong with this?

also the example in the repo does not make sense.

import React, { useRef, useState, useEffect } from 'react';
import ReactDOM from "react-dom";
import { usePdf } from '@mikecousins/react-pdf';


const App = () => {
  const [page, setPage] = useState(1);
  const canvasEl = useRef(null);

  const [loading, pages] = usePdf({
    file: 'https://URL.pdf',
    page,
    canvasEl,
  });

  return (
    <div>
      <h1>Hello there</h1>
      {loading && <span>Loading...</span>}
      <canvas ref={canvasEl} />
    </div>
  );

}

What file/line is that error occuring on? Are you using v5.5.1? What do you mean the example doesn't make sense?

Closing as stale, I'm hoping this is working now with the latest version. Open another if it isn't please.