React Intl Redux
Redux binding for React Intl.
Installation
npm install react-intl-redux react react-intl react-redux redux --save
Usage
const reducer = const store = const App = <Provider store=store> <FormattedNumber value=1000 /> </Provider> ReactDOM
locale
and messages
on load
Provide You should provide a different locale
and messages
if your user is not using en
locale.
const initialState = intl: locale: 'it' messages: 'app.greeting': 'Ciao!' // ...other initialStateconst store =
Refer to the initial-locale
example for more details.
locale
and messages
on request
Switch You could also switch locale
on user's request by dispatching updateIntl
action.
store
Provider
vs IntlProvider
In most cases, react-intl-redux
will be wrapped immediately after Provider
from react-redux
. For convenient, react-intl-redux
provides Provider
to do that for you.
However, if you don't want it, you could do it manually via IntlProvider
. For example,
const App = <Provider store=store> <IntlProvider> <App /> </IntlProvider> </Provider>
redux-immutable
Use with See the usage in test.