krasimir/octomments

Can I use Octomments in my React Application

Closed this issue · 4 comments

Can I use Octomments in my React Application

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.

Thank you @krasimir

What is OctommentsRenderer reffered to?

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.