dongmei2351 2019-06-25 15:52
浏览 128

如何在现有的非React页面中运行React组件?

I am working with a PHP app ( it's Joomla, but I don't think that matters much - I assume the answer here would be the same regardless of server-side technology ) and I want to embed a React app into one page of it.

I am building the React app outside my main application tree because I only want the output files in my web app. My approach is to use npm run build to build the React.js app and then copy the output of my /build folder into the /media/my-app folder of my site.

The output of my build process is a set of files that look like build/static/js/2.1a11a1a1.chunk.js, build/static/js/runtime-main.d5223cc00.js, build/static/js/main.0a010202.chunk.js and so on. These appear to be indexed by asset-manifest.json.

Having moved those files into /media/my-app what do I need to include in my PHP file for the app to work? Do I need to include React independently or is it part of the bundle? What do I need to include in order to be able to run the app from the manifest - I assume those hashed names are not something that we are supposed to be interacting with directly?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题