weixin_33724659 2016-08-09 23:48 采纳率: 0%
浏览 37

在多页网站上做出反应

I created a React App on a multi page website, but I don't know how to integrate it on our website.

Explanation of the problem

  1. The user load the website "/" (no react code is involved at the first loading)

  2. The user click on a link "/appReact"

  3. The _"/appReact" page loads the page and the React app code

  4. The React app sends ajax requests to the server

  5. Finally the React app gets the data and render itself

The step 3 and 4 makes the loading very slow. The step 3 delay is caused by the multipage nature of the website. The step 4 delay is caused by the response of the server

Possible solutions

I can try many different solutions or combine them, but I'm not sure if is the right way to proceed.

Optimize the react app to makes the ajax loader faster

In my case I can do that but is not the real problem.

Load the React app when the user load the website ("/")

This could improve the step 4, but we carry on the React app all around the website.

Use react router in conjunction of the multipage website

I don't know if is possible to do that. React-router can handle the url to load different apps, but I don't know if is possible to do in a multi site page without affect the site.

A trick using jquery

I have this temptation to bind the click (step 2) and hide the content of the page to run the react app. This will simulate a Single Page Application, but is a patch. I would like something more reliable.

Any suggestion?

  • 写回答

1条回答 默认 最新

  • weixin_33670713 2016-10-01 23:51
    关注

    You could try React Habitat

    That way you can pass properties to your React App directly on page load and not need the additional ajax request.

    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧