T
T
TheSnegok2021-09-18 16:29:09
React
TheSnegok, 2021-09-18 16:29:09

How to embed an html page in react created with create-react-app?

I'm trying to insert a page using a new component:

var html = require('./index.html');
const RegForm = () => {
    return (
        <div>
            <iframe src={html}></iframe>
        </div>
    )
}

export default RegForm;

Here is the error that it throws:
./src/Components/RegForm/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Is there another way to import html?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question