commit 95ca82460599c9ab59c1b662bb0bcae08124faa1
parent 1edf5043a01e9a0a65c42aa2e772510c7d07892c
Author: Konstantin Tarkus <hello@tarkus.me>
Date: Tue, 12 May 2015 12:09:32 +0300
Fix Disqus integration doc
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/docs/recipes/how-to-integrate-disqus.md b/docs/recipes/how-to-integrate-disqus.md
@@ -6,6 +6,7 @@ https://disqus.com/admin/create/
```js
import React, { PropTypes } from 'react';
+import { canUseDOM } from 'react/lib/ExecutionEnvironment';
const SHORTNAME = 'example';
const WEBSITE_URL = 'http://www.example.com';
@@ -38,12 +39,14 @@ class DisqusThread {
render() {
let { id, title, path, ...other} = this.props;
- /* eslint-disable camelcase */
- window.disqus_shortname = SHORTNAME;
- window.disqus_identifier = id;
- window.disqus_title = title;
- window.disqus_url = WEBSITE_URL + path;
- /* eslint-enable camelcase */
+ if (canUseDOM) {
+ /* eslint-disable camelcase */
+ window.disqus_shortname = SHORTNAME;
+ window.disqus_identifier = id;
+ window.disqus_title = title;
+ window.disqus_url = WEBSITE_URL + path;
+ /* eslint-enable camelcase */
+ }
return <div {...other} id="disqus_thread" />;
}