So my index.js has something like this:
import trFi from './translations/fi_FI.json';
import trSv from './translations/sv_SE.json';
ReactDOM.render(
<IntlProvider
locale={my_locale}
messages={{ fi: trFi, sv: trSv }[my_locale]}
>
<Root />
</IntlProvider>
);
And Root
has multiple sub components and all. Now how can I get the provided locale
and messages
in these sub components? I know I can pass them as props to Root
, which again passes them down, but my tree is rather deep and it's a pain in the ass to maintain this.
Is it possible to access this locale
and messages
passed to IntlProvider
in the subcomponents directly?