0.0.1 • Published 4 years ago
@comparaonline/react-intl-hooks v0.0.1
@comparaonline/react-intl-hooks
Workaround to have a React Intl Hooks
Source: https://github.com/yahoo/react-intl/issues/1224#issuecomment-449895045
Installation
This package has as peer dependencies React (^16.8) and React Intl
yarn add react-intl
If you use TS
yarn add [--dev] @types/react-intl
yarn add @comparaonline/react-intl-hooks
Usage
import { useFormatMessage, InjectIntlContext } from '@comparaonline/react-intl-hooks';
const TestIntl = () => {
const t = useFormatMessage();
return (
<div>
{ t('translation.id', { value: 'sample'}) }
</div>
)
}
const App = () => (
<IntlProvider locale={intlLocale} key={intlLocale} messages={messages} defaultLocale='en-gb'>
<InjectIntlContext>
<TestIntl />
</InjectIntlContext>
</IntlProvider>
);
0.0.1
4 years ago
0.0.1-alpha.7
4 years ago
0.0.1-alpha.6
5 years ago
0.0.1-alpha.5
5 years ago
0.0.1-alpha.4
5 years ago
0.0.1-alpha.3
5 years ago
0.0.1-alpha.2
5 years ago
0.0.1-alpha.1
5 years ago