react-file-viewer icon indicating copy to clipboard operation
react-file-viewer copied to clipboard

removed reference to window in getPhotoDriver to allow for SSR

Open Dieff opened this issue 6 years ago • 3 comments

Addresses #91 A small change to the getPhotoDriver method should allow the react components to initially render on a Node server, so this library can be used with NextJS or similar server rendering libraries.

Dieff avatar Jan 22 '19 19:01 Dieff

Can someone please merge this. I really need this working with next.js!

garethdsouza avatar Apr 03 '19 18:04 garethdsouza

Can someone please merge this. I need this working with next.js!

panghaoyuan avatar Jun 30 '20 02:06 panghaoyuan

If someone is still struggling with this problem (hello next.js user), you can use this :

import dynamic from 'next/dynamic';

// @ts-ignore
const DynamicFileViewer = dynamic(() => import('react-file-viewer'), {
  ssr: false,
});

This will disable ssr for this module

Nicolas-Menettrier avatar Oct 21 '20 13:10 Nicolas-Menettrier