yahoo/react-i13n

How does it work with redux?

Vivekbhusal opened this issue · 2 comments

Does this support redux? I don't see any reason not to, but how can I use it with combination of react-redux.Provider and react-router.
Simple Example would be

ReactDOM.render(
  <Provider store={store}>
    <div>
      <Router history={browserHistory} routes={routes} />
      {showDevTools}
    </div>
  </Provider>,
  document.getElementById('app')
);

hi @Vivekbhusal , you should be able to since react-i13n is working as pure react components, according to the usage section, we will need to use setupI13n to decorate the top level component. You can try to use that on Provider, i.e.,

var I13nProvider = setupI13n(Provider, {
    rootModelData: {site: 'foo'},
    isViewportEnabled: true
}, [somePlugin]);

ReactDOM.render(
  <I13nProvider store={store}>
    <div>
      <Router history={browserHistory} routes={routes} />
      {showDevTools}
    </div>
  </I13nProvider>,
  document.getElementById('app')
);

with the code above, we will create the app level i13n instance, then you can read integrate with components to implement the instrumentation you need.

closing this issue, hope the comment above helps :)