Source: components/baseComponents/header/Header.js

// Header.js
import React, { Component } from 'react';
import i18n from '../../../i18n';
import slovakia from '../../../assets/img/slovakia.svg';
import uk from '../../../assets/img/united_kingdom.svg';
import { withNamespaces } from 'react-i18next';

/**
 * Header
 * @extends Component
 * @hideconstructor
 */
class Header extends Component {
  changeLanguage = (lng) => {
    i18n.changeLanguage(lng);
  };
  render() {
    const { t } = this.props;
    return (
      <header className="main-header">
        <a href="/" className="logo">
          <span className="logo-mini"><b>T</b><i>W</i></span>
          <span className="logo-lg"> <b>traffic</b><i>watch</i></span>
        </a>
        <nav className="navbar navbar-static-top">
          <a href="#" className="sidebar-toggle" data-toggle="push-menu" role="button">
            <span className="sr-only">Toggle navigation</span>
          </a>
          <div className="navbar-custom-menu">
            <ul className="nav navbar-nav">

              <li>
                <a href="#" onClick={() => this.changeLanguage('en')}>
                  <img width="20" height="20" src={uk} className="fa"></img>
                </a>
              </li>
              <li>
                <a href="#" onClick={() => this.changeLanguage('sk')}>
                  <img width="20" height="20" src={slovakia} className="fa"></img>
                </a>
              </li>
            </ul>
          </div>
        </nav>
      </header>
    )
  }
}

export default withNamespaces()(Header);