title: how to import HTML file into React component and use it as a component?
body: <p>I want to import an <strong>HTML</strong> file <strong>into</strong> a <strong>React</strong> component</p>
  
  <p><a href="https://i.stack.imgur.com/VLkna.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VLkna.png" alt="enter image description here"></a></p>
  
  <p><strong>peft.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Page Title&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;This is a Heading&lt;/h1&gt;
      &lt;p&gt;This is a paragraph.&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>import perf from perf.html
  
  class Index extends React.Component {
     render(){
        return (
           &lt;iframe src="perf"&gt;&lt;/iframe&gt;   /* like this */
           &lt;iframe src="./perf"&gt;&lt;/iframe&gt; /* or like this */
           /* or like any possible way */
        );
     }
  }
  export default Index;
  </code></pre>
  
  <p>so in my case, I need to import a local HTML file and use it in  
  but I'm getting the error:</p>
  
  <blockquote>
    <p>Uncaught (in promise) Error: Module parse failed:
    C:\Users....\target.html
    Unexpected token (1:0) You may need an appropriate loader to handle
    this file type.</p>
  </blockquote>
  
  <p>any ideas? 
  How to load an HTML file inside of a React Component?
  How to add an appropriate loader to handle this file type?
  Anything?</p>
  
  <p>I find this solution as most logical:</p>
  
  <pre><code>var __html = require('./template.html');
  var template = { __html: __html };
  
  React.module.exports = React.createClass({
    render: function() {
      return(
        &lt;div dangerouslySetInnerHTML={template} /&gt;
      );
    }
  });
  </code></pre>
  
  <p>but I can not apply it because I'm getting an error:</p>
  
  <pre><code>Uncaught (in promise) Error: Module parse failed: C:\Users\....\target.html Unexpected token (1:0) You may need an appropriate loader to handle this file type. 
  | &lt;!DOCTYPE html&gt; 
  | &lt;html xmlns="w3.org/1999/xhtml"&gt;; 
  | &lt;head&gt;&lt;title&gt;
  </code></pre>