krasimir / octomments

A small library that offers GitHub issues as comments for your site/blog
https://ocs.now.sh/
MIT License
284 stars 15 forks source link

Can I use Octomments in my React Application #23

Closed muco-rolle closed 3 years ago

krasimir commented 4 years ago

Hey, Octocomments is designed to work outside of the React context but sure you can write a component that initiates it. Something like that:

function Comments() {
  useEffect(() => {
     Octomments({
      github: {
        owner: 'krasimir',
        repo: 'octomments',
      },
      issueNumber: 1,
      renderer: [OctommentsRenderer, '#comments']
    }).init();
  }, []);
  return <div id="comments"></div>;
}

The library should be added on the page + you have to be careful on re-rendering the Component.

muco-rolle commented 4 years ago

Thank you @krasimir

muco-rolle commented 4 years ago

What is OctommentsRenderer reffered to?

krasimir commented 4 years ago

The renderer is a part of Octomments that is responsible for the UI. I split the core functionality and the visual bit to allow the consumers of the library to have different design.