Skip to content

Instantly share code, notes, and snippets.

@tmbtech
Last active April 6, 2019 15:57
Show Gist options
  • Save tmbtech/92522d315d50ea5281d1 to your computer and use it in GitHub Desktop.
Save tmbtech/92522d315d50ea5281d1 to your computer and use it in GitHub Desktop.
import React from "react";
import ExecutionEnvironment from "react/lib/ExecutionEnvironment";
React.createClass({
componentWillMount() {
if (ExecutionEnvironment.canUseDOM) {
// ... has dom ..
} else {
//Server side rendering
}
},
render() {
return <SomeComponent />;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment