This app is a wrapper that allows you to run other instances of Create React App inside (à la Micro Frontends).
The app supports bidirectional communitation between the Micro Frontends via Redux.
- Clone,
npm install
andnpm start
this repository. - Go to https://github.com/mikekoro/child-octopus1 and do the same to install and run the first Micro Frontend
- Go to https://github.com/mikekoro/child-octopus2 and do the same to install and run another Micro Frontend for good measure.
This is the desired structure of your project:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
NB! Based on the blogpost from Jennifer Fu.
- Each Micro Frontend is represented by a component, eg.
<Route
path="/some/path"
render={(props) => <CreateReactApp {...props}/>}
/>
....
const CreateReactApp = (props) => {
return (
<MicroFrontend
history={props}
></MicroFrontend>
)
};
- You can pass any data/function to your Micro Frontends.
import store from './store'; // Redux store that you normally pass to <Provider store={store}>
const redux_actions = require('./store/actions/app'); // any Redux actions you might have
....
const CreateReactApp = (props) => {
return (
<MicroFrontend
history={props}
foo="bar"
methods={redux_actions}
store={store}
></MicroFrontend>
)
};