# use-intl-hook

> React custom hook to access intl object from react-intl

Latest version **0.0.1** (published 2019-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-intl-hook
pnpm add use-intl-hook
yarn add use-intl-hook
bun add use-intl-hook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2019-08-21 |
| First published | 2019-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Carloluis Rodríguez |
| Maintainers | carloluis |
| Keywords | react, hooks, react-hooks, react-intl, react-hook, react-custom-hook, internationalization |

## Links

- npm: https://www.npmjs.com/package/use-intl-hook
- Repository: https://github.com/carloluis/use-intl-hook
- Homepage: https://github.com/carloluis/use-intl-hook#readme
- Issues: https://github.com/carloluis/use-intl-hook/issues
- npm.io page: https://npm.io/package/use-intl-hook

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2019-08-21

## README

# use-intl-hook

> React `use-intl-hook` for [react-intl](https://github.com/formatjs/react-intl).

## Install

```bash
yarn add use-intl-hook
```

## Usage

```jsx
import 'intl';
import React from 'react';
import ReactDOM from 'react-dom';
import { IntlProvider, addLocaleData } from 'react-intl';
import { InjectIntlContext, useIntl } from 'use-intl-hook';

import { locale, messages } from './i18n';

const Example = () => {
  // call the useIntl hook to get the intl object from react-intl
  const intl = useIntl();
  return <h1>{intl.formatMessage({ id: 'salutation' })}</h1>;
};

// Include `InjectIntlContext` up in the tree to store the intl object from react-intl
ReactDOM.render(
  <IntlProvider key={locale} locale={locale} messages={messages}>
    <InjectIntlContext>
      <Example />
    </InjectIntlContext>
  </IntlProvider>,
  document.querySelector('#app')
);
```

---
_Source: https://npm.io/package/use-intl-hook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
