Last active
October 29, 2020 23:02
-
-
Save jhannes/750a82407ea10263d57caf0eb7c8a03b to your computer and use it in GitHub Desktop.
Localization with TypeScript and React context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MainPage() { | |
const { standardTexts, personTexts: texts } = useContext( | |
ApplicationTextsContext | |
); | |
return ( | |
<div> | |
<h2>{texts.header}</h2> | |
<div> | |
<label>{texts.givenName}:</label> | |
<input /> | |
</div> | |
<div> | |
<label>{texts.familyName}:</label> | |
<input /> | |
</div> | |
<div> | |
<label>{texts.title}:</label> | |
<input /> | |
</div> | |
<button>{standardTexts.submit}</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment