Using Google Docs Viewer in a React Application

I’m attempting to implement the Google Docs Viewer through the ‘react-google-docs-viewer’ package to showcase images, documents, and videos within my application. The example provided by the library is as follows:

<DocsViewer
  displayWidth="600px"
  displayHeight="780px"
  documentUrl="https://github.com/mozilla/pdf.js/raw/master/examples/helloworld/helloworld.pdf"
/>

However, this method isn’t functioning in my project. Do I need to log in or supply additional details? Also, are there alternative document viewing libraries compatible with React version 18.2?

you might wanna check if the URL is accessible without any pop-ups or redirects. if it’s publicly availlable and still not working, try using ‘react-doc-viewer’. it supports a lot of formats and works well with recent react versions. maybe it’s exactly what you need!

Based on my experience, using ‘react-google-docs-viewer’ can sometimes be limited by access permissions or network issues. Ensure the document’s URL is publicly accessible and that there is no authentication requirement blocking the view. Additionally, you might want to check out alternatives like ‘react-pdf’, which is quite versatile for PDF documents, or ‘react-file-viewer’, which supports a broader range of file types, offering a more seamless integration for document viewing in React applications.