title: Embed a Power BI report in React JS to get report instance
body: <p>I am trying to embed a Power BI report in React JS and I would like to embed the report and get the report instance to work further with it. I am using Power BI react extension in react to embed the report but I keep getting an error that Cannot read property 'embed' of undefined.</p>
  <p>Index.js</p>
  <pre><code>import { powerbi, models, embed } from &quot;powerbi-client&quot;;
  import React, { useState, useEffect } from &quot;react&quot;;
  import ReactDOM from &quot;react-dom&quot;;
  
  function ReportBI() {
    let token =&quot;abcExample&quot;;
    let embedUrlBi = &quot;https://app.powerbi.com/reportEmbed&quot;;
    let reportId = &quot;ReportID&quot;;
    
    const embedConfig = {
      type: &quot;report&quot;,
      id: reportId,
      embedUrl: embedUrlBi,
      accessToken: token,
      tokenType: models.TokenType.Embed
    };
  
    function test() {
      var embedContainer = document.getElementById(&quot;container&quot;);
      var report = powerbi.embed(embedContainer, embedConfig);
      console.log(report);
    }
    useEffect(() =&gt; {
      test();
    });
     
    return (
      &lt;&gt;
        &lt;div id=&quot;container&quot;&gt;&lt;/div&gt;
        
      &lt;/&gt;
    );
  }
  
  const element = &lt;ReportBI /&gt;;
  
  ReactDOM.render(element, document.getElementById(&quot;root&quot;));
  
  </code></pre>
  <p>Index.Html</p>
  <pre><code>&lt;div id=&quot;root&quot;&gt;
        &lt;div id=&quot;container&quot;&gt;&lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  <p>I am trying to get instance of the report after embedding it to do other things with it. Can I do this?</p>