My React application is generated by create-react-app. I am trying to display a html file content(exists under directory src/www/test.html) in react component.
Running "npm start" is throwing error:
Compiling... Failed to compile.
./src/www/test.html 1:0 Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
| |
React Component
import Page from '../../www/test.html';
class Example extends React.Component {
render(){
let htmlPage = {__html : Page};
return (<div dangerouslySetInnerHTML={htmlPage} /> );
}
}
================
test.html
<html>
<head></head>
<body>
<h1>I'm alive!</h1>
</body>
</html>
Please note, I don't prefer to eject from create-react-app. Looking for suggestions to overcome this issue.