Answers for "react-i18n pass variable"

2

react-i18n pass variable

/* Pass variable to react-i18next*/
/* Answer: t('message.greet', { name: 'Lucas' }) */

import { useTranslation } from 'react-i18next'

  const { t } = useTranslation()

  t('message.greet', {name: 'Lucas'})

/* in the translation */
translation: {
  message: {
   greet: "Hello {{name}}"
  }
}
Posted by: Guest on October-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language