add key to IntlProvider so it rerenders on locale change

pull/402/head^2
slowbackspace 5 years ago
parent 285b37f825
commit 571af4527f

@ -7,6 +7,8 @@ import type { State } from 'flowtype';
import { IntlProvider, addLocaleData } from 'react-intl';
// import { LANGUAGE } from 'config/variables';
import en from 'react-intl/locale-data/en';
import cs from 'react-intl/locale-data/cs';
import bn from 'react-intl/locale-data/bn';
@ -62,10 +64,13 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: St
const ReactIntlProvider = ({ children, locale }: Props) => {
// const localeData = await import(`react-intl/locale-data/${locale}`);
// addLocaleData(localeData);
const localeMessages = messages[locale];
console.log(locale);
return (
<IntlProvider
key={locale}
locale={locale}
messages={localeMessages}
>

Loading…
Cancel
Save