HelloWorldApp.jsx 1.09 KB
Newer Older
1 2 3 4
import React from 'react';
import { Provider } from 'react-redux';
import { IntlProvider, addLocaleData } from 'react-intl';
import en from 'react-intl/locale-data/en';
5
import de from 'react-intl/locale-data/de';
6 7 8
import ja from 'react-intl/locale-data/ja';
import { defaultLocale } from '../../../locales/default';
import { translations } from '../../../locales/translations';
9 10 11
import configureStore from '../store/helloWorldStore';
import HelloWorldContainer from '../containers/HelloWorldContainer';

12 13 14 15 16
addLocaleData([
  ...en,
  ...de,
  ...ja,
]);
17 18 19

const locale   = document.documentElement.lang || defaultLocale;
const messages = translations[locale] || translations[defaultLocale];
20 21 22 23 24

// See documentation for https://github.com/reactjs/react-redux.
// This is how you get props from the Rails view into the redux store.
// This code here binds your smart component to the redux store.
const HelloWorldApp = (props) => (
25
  <IntlProvider locale={locale} messages={messages}>
26 27 28 29 30 31 32
    <Provider store={configureStore(props)}>
      <HelloWorldContainer />
    </Provider>
  </IntlProvider>
);

export default HelloWorldApp;