Created
January 28, 2019 22:13
-
-
Save ratbeard/b5fcd153a26a5ce89ded89a487f5fa74 to your computer and use it in GitHub Desktop.
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
// Export a helper component that allows for easy translations in views w/o | |
// needing to use the context directly. Only handles simple key lookup at the | |
// moment. | |
function Translate({ id }: { | |
id: keyof T | |
}) { | |
return ( | |
<i18nContext.Consumer> | |
{ | |
({ translate }) => translate(id) | |
} | |
</i18nContext.Consumer> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment