joyent-portal/spikes/stacks/redux-loop/src/client/root.js
2016-10-17 21:36:31 +01:00

47 lines
959 B
JavaScript

const React = require('react');
const ReactHotLoader = require('react-hot-loader');
const ReactRouter = require('react-router');
const ReactRedux = require('react-redux');
const ReactIntl = require('react-intl');
const App = require('./containers/app');
const store = require('./state/store');
const {
AppContainer
} = ReactHotLoader;
const {
BrowserRouter
} = ReactRouter;
const {
Provider
} = ReactRedux;
const {
IntlProvider
} = ReactIntl;
// http://stackoverflow.com/a/38150585
const locale = (
navigator.languages && navigator.languages[0] || // Chrome / Firefox
navigator.language || // All browsers
navigator.userLanguage // IE <= 10
);
module.exports = () => {
return (
<AppContainer>
<Provider store={store()}>
<IntlProvider
locale={locale}
defaultLocale='en'
>
<BrowserRouter>{App}</BrowserRouter>
</IntlProvider>
</Provider>
</AppContainer>
);
};