Reactjs - Update layout of other diagram

I’m trying to sync two diagrams so that when zooming in one of them, the other one zooms to the same level automatically, like in the following example:

However, I’m using reactjs and generating the plotly charts with JSX. How can I translate this example into reactjs code? I’m currently trying to call Plotly.relayout from the callback function assigned to the onRelayout property, but I’m getting the “DOM element provided is null or undefined” error when this function is called.

I could perhaps provide some code if necessary, but for now I would just be happy if someone could show me any working reactjs example.