I saw one beautiful star animation in codesandbox link I want to apply it in my project, for this I created a separate HTML file and put the code from the link. Now i am trying to render html
file in my jsx
import htmlFile from 'Assets/Styles/Test.html';
function Page () {
return <iframe src={htmlFile}></iframe>
}
But I am getting this kind of error
What is it connected with? How can I solve this problem?
It looks like you are trying to import an HTML file into your JavaScript code, but the JavaScript module system doesn't know how to handle HTML files.
One solution is to use an HTML loader to handle the import of the HTML file. In your webpack configuration, you can add a rule that tells webpack to use the HTML loader for HTML files.
Here's an example of how you might do this:
module: {
rules: [
{
test: /\.html$/,
use: 'html-loader'
}
]
}
Hopefully that helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.