@@ -172,6 +172,23 @@ function Capitalized() {
172172}
173173```
174174
175+ Optionally ` useT ` can take as param a custom Native Instance:
176+
177+ ``` javascript
178+ import { useT } from ' @transifex/react' ;
179+ import { createNativeInstance } from ' @transifex/native' ;
180+
181+ const customTX = createNativeInstance ({
182+ token: ' token' ,
183+ secret: ' secret' ,
184+ });
185+
186+ function Component () {
187+ const t = useT (customTX);
188+ // ...
189+ }
190+ ```
191+
175192## ` useLanguages ` hook
176193
177194Returns a state variable that will eventually hold the supported languages of
@@ -195,6 +212,23 @@ function LanguageList () {
195212}
196213```
197214
215+ Optionally ` useLanguages ` can take as param a custom Native Instance:
216+
217+ ``` javascript
218+ import { useT } from ' @transifex/react' ;
219+ import { createNativeInstance } from ' @transifex/native' ;
220+
221+ const customTX = createNativeInstance ({
222+ token: ' token' ,
223+ secret: ' secret' ,
224+ });
225+
226+ function Component () {
227+ const languages = useLanguages (customTX);
228+ // ...
229+ }
230+ ```
231+
198232## ` useLocale ` hook
199233
200234Returns a state variable with the currently selected locale.
@@ -211,6 +245,23 @@ function DisplayLocale () {
211245}
212246```
213247
248+ Optionally ` useLocale ` can take as param a custom Native Instance:
249+
250+ ``` javascript
251+ import { useT } from ' @transifex/react' ;
252+ import { createNativeInstance } from ' @transifex/native' ;
253+
254+ const customTX = createNativeInstance ({
255+ token: ' token' ,
256+ secret: ' secret' ,
257+ });
258+
259+ function Component () {
260+ const locale = useLocale (customTX);
261+ // ...
262+ }
263+ ```
264+
214265## ` useTX ` hook
215266
216267Returns a state variable with the Native instance.
@@ -344,6 +395,23 @@ function Inner({ ready }) {
344395}
345396```
346397
398+ Optionally ` useTranslations ` can take as a second param a custom Native Instance:
399+
400+ ``` javascript
401+ import { useT } from ' @transifex/react' ;
402+ import { createNativeInstance } from ' @transifex/native' ;
403+
404+ const customTX = createNativeInstance ({
405+ token: ' token' ,
406+ secret: ' secret' ,
407+ });
408+
409+ function Component () {
410+ const { ready } = useTranslations (' inner' , customTX);
411+ // ...
412+ }
413+ ```
414+
347415## ` TXProvider ` provider
348416If you need to use more than one Transifex Native instances - like for example if you have a component library - you can use this provider to pass the desired instance to the children components.
349417
0 commit comments