React Core & Hooks (407 Qs)•Part 2: React Router & Navigation (78 - 88)
What is React Intl?
junior LevelCode ExampleRouting
React Intl is an open-source internationalization (i18n) library created by FormatJS for React applications. It provides React components and an API to format dates, numbers, strings, and handle pluralization across different languages and locales.
jsx
import { FormattedMessage, IntlProvider } from 'react-intl';
function App() {
return (
<IntlProvider locale="en" defaultLocale="en">
<h1>
<FormattedMessage id="greeting" defaultMessage="Welcome back, {name}!" values={{ name: 'Alex' }} />
</h1>
</IntlProvider>
);
}