Skip to content

Instantly share code, notes, and snippets.

@theodesp
Last active April 6, 2020 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodesp/044c2cd340c75015d190d55e003703e8 to your computer and use it in GitHub Desktop.
Save theodesp/044c2cd340c75015d190d55e003703e8 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Language } from '@wapps/gatsby-plugin-i18next';
const LanguageSwitcher = ({ changeLng, lng, availableLngs }) => (
<select onChange={(e) => changeLng(e.target.value)}>
{
availableLngs.map((value) => (
<option key={value} selected={lng === value}>{value}</option>
))
};
</select>);
export default props => (
<Language>{lngProps => <LanguageSwitcher {...props} {...lngProps} />}</Language>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment