yaodingyd / react-flickity-component

A React.js component for using @desandro's Flickity
314 stars 51 forks source link

use asNavFor option for server side rendering #111

Closed seyyed-sina closed 3 years ago

seyyed-sina commented 4 years ago

how can we use external packages like fade and asNavFor?! I have to slider and want to make asNavFor one for another. how can I achieve this? I have installed these packages and using nextjs but it gives 'window is not defined'

Annotation 2020-08-03 212914

nboliver commented 3 years ago

@spostad7 you can try something like this:

const fade =
  typeof window !== 'undefined' ? require('flickity-fade') : () => null;

... 

{fade && <Flickity />}