Skip to content

Instantly share code, notes, and snippets.

@tnormington
Created April 5, 2018 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnormington/f82160ab98d404b9e91774683c733678 to your computer and use it in GitHub Desktop.
Save tnormington/f82160ab98d404b9e91774683c733678 to your computer and use it in GitHub Desktop.
A Disqus Thread React component, pass in a URL and a unique ID.
import React, { Component } from 'react';
export default class DisqusThread extends Component {
constructor(props) {
super(props)
window.disqus_config = {
page: {
url: props.url,
identifier: props.identified
}
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://tjn-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
render() {
return (
<div id="disqus_thread" />
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment