我了解如何在使用时将自定义道具传递给不同的微应用,single-spa
但我想知道如何获取 api 调用表单 app1 的输出并在 app2 中使用它。app1 正在使用react-redux
,app2 将使用react hooks
.
import {registerApplication, start} from 'single-spa'
registerApplication(
'navBar', // Name of this single-spa application
() => import('./nav/navbar.app.js').then(module => module.navBar),
() => true
)
registerApplication(
'app1', // Name of this single-spa application
() => import('./root.app.js'),//loadingFunction, // Our loading function
() => true, //activityFunction // Our activity function
)
registerApplication(
'app2', // Name of this single-spa application
() => import('./app2/app2.app.js').then(module => module.app2),
location =>
location.pathname === '/app2' ||
location.pathname.startsWith('/app2'),
{
some: 'value',
}
)
start()
或者我如何调用 root api 调用并在所有微应用程序之间共享输出。以上是我的index.js
,由webpack
.
我正在使用 single-spa 版本 4.x 和 webpack 4.x