Search code examples
javascriptreactjsapimesibo

How to initialize mesibo console in reactjs. for web app and not android apps. In reactJS not in Reactnative


How can I initialize mesibo connection in my reactjs web app with django backend.
I dont find any resources of doing that. even though i have included
<script type="text/javascript" src="https://api.mesibo.com/mesibo.js"></script>
in index.html and its loading in browser as well but having initialized the

initializeApiConn = () => {
  this.setState({
    api: new Mesibo()
  })
}

its not recognizing Mesibo()
can i have any resources and any links to understand this connection of mesibo with reactjs.

---------------------------------
EDIT:

  • I have included mesibo js in <head>

Solution

  • If you are including mesibo js your index.html, you may need to use window.Mesibo() in ReactJS

    Alternatively, use DOM method to load mesibo.

    const script = document.createElement("script");
    script.src = "https://api.mesibo.com/mesibo.js";
    document.body.appendChild(script);