Skip to content

Instantly share code, notes, and snippets.

@vkbansal
Created January 11, 2022 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkbansal/ccff35436adb3f86400bbd12bd02ced8 to your computer and use it in GitHub Desktop.
Save vkbansal/ccff35436adb3f86400bbd12bd02ced8 to your computer and use it in GitHub Desktop.
import React from "react";
import { useLocaleStrings, LocaleString } from "./StringsContext";
export default function HomePage(): React.ReactElement {
const { getString } = useLocaleStrings();
return (
<div>
<h1>Home</h1>
- <p>{getString("homePageContent.para1")}</p>
+ <p>{getString("homePageContent.para1", { name: "John Doe 1" })}</p>
- <LocaleString strKey="homePageContent.para2" as="p" />
+ <LocaleString
+ strKey="homePageContent.para2"
+ as="p"
+ variables={{ name: "World!" }}
+ />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Explicabo
optio, fuga cum velit corporis ipsam labore saepe assumenda inventore
nobis. Laboriosam, cumque blanditiis minima accusantium inventore
mollitia dolor optio exercitationem?
</p>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment