diego
diego

Reputation: 31

Attempted import error: 'withTranslation' is not exported from 'react-i18next'

I am new to React nad I want to export a component but I get a error with 'withTranslation'

a summary of my code (version:"i18next": "^17.0.6","react-i18next": "^9.0.10",):

import React, {Component} from 'react';

import { translate } from 'react-i18next';
//version: "i18next": "^17.0.6","react-i18next": "^9.0.10",

//..........
//.............
class FromAlumno extends Component {
//................
//.....................
}

export default withTranslation("translation")(FromAlumno);

Upvotes: 3

Views: 4310

Answers (1)

Daniel Broman
Daniel Broman

Reputation: 46

The problem is not the exporting in your component, the problem is that you haven't imported withTranslation from react-i18next. Just switch your import to this:

import { withTranslation } from 'react-i18next';

I would recommend reading the documentation for react-i18next before posting here too.

https://react.i18next.com/latest/withtranslation-hoc

Upvotes: 3

Related Questions