繁体   English   中英

有没有办法在React应用中链接未反应的html文件?

[英]Is there a way to link non-react html files in a react app?

假设我在example.com上托管了一个React应用程序。 现在,我已经有一个非常简单的html / js网站,我想在example.com/example上显示它。 如果我用react重写网站,我可以很容易地做到这一点,但是我不想这样做,因为html / js网站是如此简单,因此无需编写react。

有什么办法可以直接将这个html / js网站与我的项目的其余部分链接起来?

使用create-react-app创建React应用时,您将具有以下文件系统结构:

my-app/
 README.md
 node_modules/
 package.json
 public/
   index.html
   custom-page.html <-- Create custom page
   favicon.ico
 src/
   App.css
   App.js
   App.test.js
   index.css
   index.js
   logo.svg

https://facebook.github.io/create-react-app/docs/folder-structure

因此,您可以在/public目录中创建任何静态页面并对其进行引用。 /public目录中的所有资源将在您网站的根目录中可用。

例如, custom-page.html会被访问的http://本地主机:3000 /定制page.html中

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM