按照官方文档配置,将已有React项目改造为微应用,配置代码都写在了react项目index.js入口文件中,且两种声明生命周期的方式都试过了,但主应用中一直报错提示Unable to retrieve lifecycles of react-app after loading it,请问具体应该如何解决
具体配置如下:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { isInIcestark, setLibraryName } from '@ice/stark-app';
export function mount(props) {
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
props.container
);
}
export function unmount(props) {
ReactDOM.unmountComponentAtNode(props.container);
}
setLibraryName('microApp');
if (!isInIcestark()) {
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
}
reportWebVitals();