I have a React application, which uses GraphQL to fetch data from backend. Requested data is a html code (content with some divs) built with CMS page editor and rendered using React.
HTML code is rendered using https://www.npmjs.com/package/html-react-parser
How can I access <button class="someClass">SUBSCRIBE</button> through different react component ? The reason I want to access it through react is that I have a Newsletter module which is responsible for making GQL requests and validating recaptcha, as well as Popup module. The popup should be displayed when we hit SUBSCRIBE - this is why I want to attach onClick to that button.
Should I use document.getElementsByClassName in componentDidMount ? Or is there a better way to achieve things like this ?