Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/streamich/use-t

🗺 Translations with React hooks
https://github.com/streamich/use-t

Last synced: about 1 month ago
JSON representation

🗺 Translations with React hooks

Awesome Lists containing this project

README

        







🗺


use-t


Translations for React.








Installation



npm i use-t




Reference

```js
import {Provider, useT, withT, Trans, Consumer, context} from 'use-t';
```

- [``](./docs/Provider.md)
- [`useT()`](./docs/useT.md)
- [`withT()`](./docs/withT.md)
- [``](./docs/Trans.md)
- [``](./docs/Consumer.md)
- [`context`](./docs/context.md)
- [`createTranslations()`](./docs/createTranslations.md)




Example

```jsx
import {Provider, useT} from 'use-t';

const Hello = (props) => {
const [t] = useT();
return (



{t('Hello')}, {props.name}!


{t.t('hello_user')`Hello, ${props.name}!`}


);
};

`Hi, ${name}!`
}
}
}}>

```




License


Unlicense — public domain.