Simple usage
- In any component, import Talker's hook
useT. - Destructure the translation function
TfromuseT - Fetch the desired sentence as if you were directly accessing an object, by adding
.between each key. Based on the JSON example above, we could print the sentenceThe connection succedeedby simply writingT("feedback.success")
import React from "react";
import { useT } from "talkr";
export default function MyComponent() {
const { T } = useT();
return (
<>
<h1>{T("hello")}</h1>
<div>{T("feedback.success")}</div>
</>
);
}