title: Switch the language in React without using external libraries
body: <p>What ways to change language in React can you suggest without using external libraries? My way is to use the ternary operator <code>{language === 'en'? 'title': 'titre'}</code>. If language is <code>en</code>, display<code>title</code> if not, display <code>titre</code>. What other way can you recommend. For example, that the translations should be placed in a separate json file.</p>
  
  <p>Code here: <a href="https://stackblitz.com/edit/react-eu9myn" rel="nofollow noreferrer">https://stackblitz.com/edit/react-eu9myn</a></p>
  
  <pre><code>class App extends Component {
    constructor() {
      super();
      this.state = {
        language: 'en'
      };
    }
  
    changeLanguage = () =&gt; {
      this.setState({
        language:  'fr'
      })
    }
  
    render() {
      const {language} = this.state;
      return (
        &lt;div&gt;
          &lt;p&gt;
            {language === 'en' ? 'title' : 'titre'}
          &lt;/p&gt;
          &lt;button onClick={this.changeLanguage}&gt;change language&lt;/button&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>