FrontendDeveloper.in

React question detail

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 }) => (
);

MyComponent.propTypes = {
intl: intlShape.isRequired,
};

export default injectIntl(MyComponent);
Back to all React questions
Get LinkedIn Premium at Rs 399