Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Init 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
Nesting / Sub Content Referencing
How Nesting Works
To use nested content in a React component, leverage the useIntlayer hook from the react-intlayer package. This hook retrieves the correct content based on the specified key. Here's an example of how to use it:
Copy the code to the clipboard
import type { FC } from "react";
import { useIntlayer } from "react-intlayer";
const NestComponent: FC = () => {
const { fullNestedContent, partialNestedContent } = useIntlayer(
"key_of_my_second_dictionary"
);
return (
<div>
<p>Full Nested Content: {JSON.stringify(fullNestedContent)}</p>
<p>Partial Nested Value: {partialNestedContent}</p>
</div>
);
};
export default NestComponent;Setting Up Nesting
To use nested content in a React component, leverage the useIntlayer hook from the react-intlayer package. This hook retrieves the correct content based on the specified key. Here's an example of how to use it:
Copy the code to the clipboard
import type { FC } from "react";
import { useIntlayer } from "react-intlayer";
const NestComponent: FC = () => {
const { fullNestedContent, partialNestedContent } = useIntlayer(
"key_of_my_second_dictionary"
);
return (
<div>
<p>Full Nested Content: {JSON.stringify(fullNestedContent)}</p>
<p>Partial Nested Value: {partialNestedContent}</p>
</div>
);
};
export default NestComponent;Using Nesting with React Intlayer
To use nested content in a React component, leverage the useIntlayer hook from the react-intlayer package. This hook retrieves the correct content based on the specified key. Here's an example of how to use it:
Copy the code to the clipboard
import type { FC } from "react";
import { useIntlayer } from "react-intlayer";
const NestComponent: FC = () => {
const { fullNestedContent, partialNestedContent } = useIntlayer(
"key_of_my_second_dictionary"
);
return (
<div>
<p>
Full Nested Content: {JSON.stringify(fullNestedContent)}
{/* Output: {"content": "content", "subContent": {"contentNumber": 0, "contentString": "string"}} */}
</p>
<p>
Partial Nested Value: {partialNestedContent}
{/* Output: 0 */}
</p>
</div>
);
};
export default NestComponent;Additional Resources
For more detailed information on configuration and usage, refer to the following resources:
These resources provide further insights into the setup and usage of Intlayer in different environments and with various frameworks.