3

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);
1
  • Are you importing it like - import { withTranslation } from 'react-i18next'; Commented Jul 18, 2019 at 10:47

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.