Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
This doc is out of date, the base version has been updated on 21 January 2026.
Go to English docVersion History
- "Initial history"v5.5.1029/06/2025
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
React Integration: useDictionary Hook Documentation
This section provides detailed guidance on using the useDictionary hook within React applications, enabling efficient handling of localised content without a visual editor.
Example Usage in React
Below is an example of how to use the useDictionary hook in a React component:
Copy the code to the clipboard
import type { FC } from "react";
import { useDictionary } from "react-intlayer";
import componentContent from "./component.content";
const ComponentExample: FC = () => {
const { title, content } = useDictionary(componentContent);
return (
<div>
<h1>{title}</h1>
<p>{content}</p>
</div>
);
};Additional Tips
- Type Safety: Always use
Dictionaryto define your dictionaries to ensure type safety. - Localisation Updates: When updating content, ensure all locales are consistent to avoid missing translations.
This documentation focuses on the integration of the useDictionary hook, providing a streamlined approach to managing localised content without relying on visual editor functionalities.