how do I change language in react-i18next

Try this, pass the language inside the function to invoke different languages.

import React from 'react'
import { useTranslation } from 'react-i18next'

import classes from './intro.module.scss'

export default function Intro() {
    const { t, i18n } = useTranslation()

     const changeLanguageHandler = (lang) =>
     {
       i18n.changeLanguage("de")
     }



    return (
        <div className={classes.container}>
            <div className={classes.innerContainer}>
            <h1>{t('Welcome to React')}</h1>
            </div>
        </div>
    )
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)