'how to set onChange handler to change the language in react i18next

-the select form that allow the user to change the language don't work with onclick how can I use onChange handler

  • am using react i18next.

*keep in mind that am not getting any errors or warnings. this is my code

import i18n from 'i18next';

export default function Footer() {
const languages = [
    {
      code: "fr",
      name: "francais",
      countryCode:"fr"
    },
    {
      code: "en",
      name: "english",
      countryCode:"gb"
    },
    {
      code: "ar",
      name: "العربية",
      countryCode:"sa"
    }
  ]


return <Form.Select aria-label="Default select example" >
{languages.map(({code,name, countryCode})=>{
  return(
    <option key={countryCode} onClick={()=> i18n.changeLanguage(code)}>{name}</option>
  )
})}
</Form.Select>
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source