Skip to main content

Simple usage

  • In any component, import Talker's hook useT.
  • Destructure the translation function T from useT
  • 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 sentence The connection succedeed by simply writing T("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>
</>
);
}