UNPKG

react-intl

Version:

Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.

29 lines (28 loc) 837 B
import { type IntlCache } from "@formatjs/intl"; import * as React from "react"; import type { IntlConfig, IntlShape } from "../types.js"; import { type DefaultIntlConfig } from "../utils.js"; interface State { /** * Explicit intl cache to prevent memory leaks */ cache: IntlCache; /** * Intl object we created */ intl?: IntlShape; /** * list of memoized config we care about. * This is important since creating intl is * very expensive */ prevConfig: IntlConfig; } export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> { static displayName: string; static defaultProps: DefaultIntlConfig; private cache; state: State; static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null; render(): React.JSX.Element; }