1
0
mirror of https://github.com/yldio/copilot.git synced 2025-01-24 18:00:11 +02:00
copilot/spikes/stacks/redux-thunk/src/client/root.js

48 lines
955 B
JavaScript
Raw Normal View History

2016-10-14 12:45:12 +03:00
const React = require('react');
const ReactHotLoader = require('react-hot-loader');
const ReactRouter = require('react-router');
const ReactRedux = require('react-redux');
2016-10-17 00:35:09 +03:00
const ReactIntl = require('react-intl');
2016-10-14 12:45:12 +03:00
const App = require('./containers/app');
const store = require('./store');
const {
AppContainer
} = ReactHotLoader;
const {
BrowserRouter,
} = ReactRouter;
const {
Provider
} = ReactRedux;
2016-10-17 00:35:09 +03:00
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
);
2016-10-14 12:45:12 +03:00
module.exports = () => {
return (
<AppContainer>
<Provider store={store()}>
2016-10-17 00:35:09 +03:00
<IntlProvider
locale={locale}
defaultLocale='en'
>
<BrowserRouter>{App}</BrowserRouter>
</IntlProvider>
2016-10-14 12:45:12 +03:00
</Provider>
</AppContainer>
);
};