Skip to content

Instantly share code, notes, and snippets.

@ahayes91
Created June 12, 2021 23:46
Show Gist options
  • Save ahayes91/436bfe5bb5176cacbf6d9be7967e5106 to your computer and use it in GitHub Desktop.
Save ahayes91/436bfe5bb5176cacbf6d9be7967e5106 to your computer and use it in GitHub Desktop.
An example of the providers and wrapped functionality around a more complex app in a microfrontend Single-SPA application
import React from 'react';
// ... all the other stuff our app uses, Redux Saga / custom providers / MUI components & themes / i18n
const App = ({ basename }) => {
const { userContext } = getUserCtx();
return (
<BrowserRouter basename={basename}>
<LocaleProvider>
{locale => (
<MuiThemeProvider theme={studentTheme}>
<CssBaseline />
<Provider store={store}>
<IntlProvider locale={locale} messages={getLocaleFile(locale)}>
<Routes userContext={userContext} />
</IntlProvider>
</Provider>
</MuiThemeProvider>
)}
</LocaleProvider>
</BrowserRouter>
);
};
App.propTypes = {
basename: PropTypes.string,
};
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment