firtoz / react-three-renderer

Render into a three.js canvas using React.
https://toxicfork.github.com/react-three-renderer-example/
MIT License
1.49k stars 155 forks source link

updated README example to check for the DOM/Window for universal apps #154

Closed rorz closed 7 years ago

rorz commented 7 years ago

My use-case for your awesome renderer is in an isomorphic / universal app, and I have a feeling others will have the same needs.

Of course, if you're creating a universal app then you should be able to handle this kind of checking yourself. However, in the case of libraries such as GatsbyJS, which are making universal apps much more accessible, your example might be the first one a user encounters that requires checking that 'window' is defined.

I can confirm my edits work on a GatsbyJS instance hosted with Netlify.

toxicFork commented 7 years ago

I had a thought on why I haven't merged this, it's because it'd be adding another dependency for using an example and it feels like an edge case, closing it to be realistic instead of coming back every time and thinking "... i'll take another look later"