Skip to content

Instantly share code, notes, and snippets.

@helloanil
Created February 12, 2019 00:48
Show Gist options
  • Save helloanil/82da2e08fbd362802987c836bb586c5d to your computer and use it in GitHub Desktop.
Save helloanil/82da2e08fbd362802987c836bb586c5d to your computer and use it in GitHub Desktop.
CRA-I18N App.js - finishing translations
import React, { useContext } from 'react';
import logo from './logo.svg';
import './App.css';
import { I18nContext } from './i18n';
import LanguageSelect from './components/LanguageSelect';
const App = () => {
const { translate } = useContext(I18nContext);
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<LanguageSelect />
<p>{translate('edit_and_save')}</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
{translate('learn_react')}
</a>
</header>
</div>
);
};
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment