Closed shellka closed 9 years ago
Interesting, actually never tried to render it server side. Seems like its looking for the DOM element when it does not exists. Not sure what the best solution is atm.
Here is a suggestion: add a check to see if DOM can be used
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
And mock document object in non-DOM environments.
yes, i did it in my fork: https://github.com/juvty/react-scroll/commit/7f6d72353c290c19a796dd3c7767f1e1d4c9dd88
make a PR and will look at it :)
Should work now!
@fisshy
Hi all.
The following option:
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
has a conflict with a GSAP option for fixing Server-Side rendering: http://greensock.com/forums/topic/7422-using-tweenlite-timelinelite-server-side-with-nodejs/
I think we need to use an another option in this library.
Im trying to render application on server-side with React.renderToString method https://github.com/mhart/react-server-example and have got an error: