How to access current locale with React Intl?
You can get the current locale in any component of your application using injectIntl()
:
import { injectIntl, intlShape } from 'react-intl';const MyComponent = ({ intl }) => <div>{`The current locale is ${intl.locale}`}</div>;MyComponent.propTypes = {intl: intlShape.isRequired,};export default injectIntl(MyComponent);
September 19, 2022
1689
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS