使用 React 将多个 SPA 集成到一个 SPA 中 [英] Integrating multiple SPAs in one single SPA using React

查看:44
本文介绍了使用 React 将多个 SPA 集成到一个 SPA 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在重新构想我们的软件应用套件,需要一些建议.

We’re in the process of re-imagining our suite of software applications and need some advice.

目前,我们有 3 个相当大的 SPA(在 react&redux 中编码),我们需要将它们重写为单个 SPA.

Currently, we have 3 fairly large SPAs (coded in react&redux) that we need to rewrite into a single SPA.

我们希望用 React&Redux 编写的新 SPA 替换每个单独的 SPA.

What we’d like is to replace each of the individual SPAs with a new SPA written using React&Redux.

如何实现?

感谢您的帮助!!

推荐答案

为什么需要将它们重写为单个 SPA?您正在尝试解决哪些问题?

Why do you need to rewrite them into a single SPA? What are the issues you are trying to solve?

如果您试图在不刷新页面的情况下让三个 SPA 协同工作,您可以考虑使用 单人水疗.它是一个微前端,允许将多个 SPA 编织在一起以创建单个 SPA.使用这种方法,您可以通过将共享依赖项提升到单个包中来优化加载时间,该包只加载一次并在三个​​应用之间共享.

If you are trying to have the three SPA work together without refreshing the page you could look into using single-spa. It is a micro front-ends that allows multiple SPA to be knit together to create a single SPA. With this approach, you could optimize load time by hoisting shared dependencies into a single bundle that is loaded once and shared between the three apps.

单水疗项目示例

这篇关于使用 React 将多个 SPA 集成到一个 SPA 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆