Microfrontends - React in an Angular host

Discussão em 'Angular' iniciado por JrDeveloper, Abril 25, 2025.

  1. JrDeveloper

    JrDeveloper Guest

    I've been trying to have a React app using Vite acting as a microfrontend in an Angular shell / host using Native Federation (also tried using Module Federation). After some time searching, I managed to find examples on GitHub like this one: manfredsteyer/mf-nf-poc (the React microfrontend doesn't seem to be using Vite, but still).

    I also found manfredsteyer/native-federation-react-example. However, beside this being "React remote and React host" (it also works when used in an Angular host), once I add react-router-dom and switch to using the router with createBrowserRouter(), everything falls apart and the apps simply don't load. There's errors claiming that TypeError: c.createContext is not a function.

    bootstrap.tsx:

    <React.StrictMode>
    <RouterProvider router={router} />
    </React.StrictMode>


    My question is: is it possible to do routing using react-router-dom in a microfrontend that is hosted in Angular? And also is it possible to do routing in a React host either? I am interested in learning both, but neither seem to work as per my attempts and there's just 0 resources out there that show React microfrontend routing.

    Before I forget, I did try using nearly any npm package out there related to Native Federation as well as Module Federation and all the resources lack proper examples with React routing.

    Continue reading...

Compartilhe esta Página