'<script> tag problem in html file in react js

Please cosnsider me as beginner. if you think this question is stupid, sorry for that

  1. I added html file in react js as "num.html"
  2. In that "num.html", it has tag.
  3. I want to use that html file in my react component. so, i rendered in my app component.
  4. it was showing error like :

ERROR in ./src/num.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

  1. I want to use script tag on that html file . but react js not allowing. is there any alternative?


Solution 1:[1]

At first you should have convert your html file to js file. Then you put react js common format. Now you will be able your html code in react component.

Solution 2:[2]

react has a file index.html origin, i think u can put your javascript in this file, bellow root element. But I think no one do that. :v

Solution 3:[3]

first you should replace .html to .js then type rsc and vs code give stracter then paste the HTML code in react file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Md Asgor Ali
Solution 2 Nhut Pham
Solution 3 Abdullah Al Mahmud