UNPKG

900 BTypeScriptView Raw
1import { IntlCache } from '@formatjs/intl';
2import * as React from 'react';
3import type { IntlConfig, IntlShape } from '../types';
4import { DefaultIntlConfig } from '../utils';
5interface State {
6 /**
7 * Explicit intl cache to prevent memory leaks
8 */
9 cache: IntlCache;
10 /**
11 * Intl object we created
12 */
13 intl?: IntlShape;
14 /**
15 * list of memoized config we care about.
16 * This is important since creating intl is
17 * very expensive
18 */
19 prevConfig: IntlConfig;
20}
21export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
22 static displayName: string;
23 static defaultProps: DefaultIntlConfig;
24 private cache;
25 state: State;
26 static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
27 render(): React.JSX.Element;
28}
29export {};