use-t
v1.6.3
Published
React translations
Downloads
152
Readme
import {Provider, useT, withT, Trans, Consumer, context} from 'use-t';
import {Provider, useT} from 'use-t';
const Hello = (props) => {
const [t] = useT();
return (
<div>
<div>
{t('Hello')}, {props.name}!
</div>
<div>
{t.t('hello_user')`Hello, ${props.name}!`}
</div>
</div>
);
};
<Provider locale="de" map={{
de: {
main: {
Hello: 'Hallo',
hello_user: (name) => `Hi, ${name}!`
}
}
}}>
<Hello name="Mike" />
</Provider>