title: How to change language with i18next in React
body: <p>I am trying to add the i18next translation system to my React app and I've already configured everything, but I can't seem to find how to change the language (using a select or a button, for example).</p>
  
  <p>I've followed <a href="https://dev.to/ksushiva/how-to-translate-your-react-js-app-with-i18next-12mn" rel="nofollow noreferrer">this</a> easy guide to set the whole thing up.
  But there's nothing on how to manually change the language.
  And, as you can see <a href="https://github.com/i18next/react-i18next/blob/master/example/react/src/App.js" rel="nofollow noreferrer">here</a>, there's a function to change the language, but it's inside a function component:</p>
  
  <pre><code>function Page() {
  const { t, i18n } = useTranslation();
  
    const changeLanguage = lng =&gt; {
      i18n.changeLanguage(lng);
    };
  
    return ([...])
  }
  </code></pre>
  
  <p>However, my component is a class extending from component and it doesn't seem to work the same way:</p>
  
  <pre><code>class Profile extends Component {
    [...]
  }
  export default withTranslation()(Profile);
  </code></pre>
  
  <p>How should I do it then? I've no clue.</p>