Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
deskbookers-react-intl-redux
Advanced tools
Redux binding for React Intl.
npm install react-intl-redux react react-intl react-redux redux --save
import React from 'react'
import ReactDOM from 'react-dom'
import {createStore, combineReducers} from 'redux'
import {FormattedNumber} from 'react-intl'
import {Provider, intlReducer} from 'react-intl-redux'
import reducers from '<project-path>/reducers'
const reducer = combineReducers({
...reducers,
intl: intlReducer,
})
const store = createStore(reducer)
const App = () => (
<Provider store={store}>
<FormattedNumber value={1000} />
</Provider>
)
ReactDOM.render(<App />, document.getElementById('container'))
locale
and messages
on loadYou 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 initialState
}
const store = createStore(reducer, initialState)
Refer to the initial-locale
example for more details.
locale
and messages
on requestYou could also switch locale
on user's request by dispatching updateIntl
action.
import {updateIntl} from 'react-intl-redux'
store.dispatch(updateIntl({
locale,
messages,
}))
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,
import React from 'react'
import {IntlProvider} from 'react-intl-redux'
import {Provider} from 'react-redux'
const App = () => (
<Provider store={store}>
<IntlProvider>
<App />
</IntlProvider>
</Provider>
)
redux-immutable
See the usage in test.
FAQs
Redux binding for React Intl
The npm package deskbookers-react-intl-redux receives a total of 2 weekly downloads. As such, deskbookers-react-intl-redux popularity was classified as not popular.
We found that deskbookers-react-intl-redux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.