I have created a react
micro front end
application in single spa
using the command create-single-spa
. Inside the singleSpaReact
method, the root component is mentioned.
const lifecycles = singleSpaReact({
React,
ReactDOM,
Router,
rootComponent: Root,
errorBoundary(err, info, props) {
// Customize the root error boundary for your microfrontend here.
return null;
},
});
But the react micro application itself have couple of pages. But I don't understand how to define the routing inside the singleSpaReact
method. Can anyone help me on this.
I had the same issue of you and I finally managed this :
I define my singleSpaReact :
And I defined my Routes in My Layout component :
Be aware that I managed this with react-router-dom V6 but if you are with under V6, use Switch instead of Routes