如何在不遇到生命周期问题的情况下将 React/Redux 应用程序嵌入到另一个 React/Redux 应用程序中? [英] How to embed a React/Redux app in another React/Redux app without running into lifecycle issues?

查看:32
本文介绍了如何在不遇到生命周期问题的情况下将 React/Redux 应用程序嵌入到另一个 React/Redux 应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

App A 是一个独立的单页 React/Redux 应用程序,旨在插入其他应用程序(不一定用 React/Redux 编写).我正在尝试将应用程序 A 嵌入到另一个单页 React/Redux 应用程序 B 中,如下所示:

App A is a self-contained, single-page React/Redux application that is meant to be pluggable into other applications (not necessarily written in React/Redux). I'm trying to embed app A in another single-page React/Redux app B as follows:

  • 在应用B中,创建一个组件ComponentA,其路由与应用A使用的路由相同,其render()方法生成一个DIV 标记以托管应用 A.

  • In app B, create a component, ComponentA, whose route is the same as that used by app A, and whose render() method generates a DIV tag to host app A.

在 ComponentA 的 componentWillMount() 方法中,通过在末尾附加相应的

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