How to fix Uncaught ReferenceError: __ is not defined?

Please help to fix it!!!
Trying to connect the translation of the i18n-2
import i18n from 'i18n-2'
export class Navbar extends Component {
 constructor(props) {
super(props)
}
 render() {
 return (
 the <li><indexlink to="/" activeclassname="{styles.active}">{__('Home')}</indexlink></li>
)
}


app.js
i18n.expressBind(app, {
 locales: ['EN', 'en'],
 directory: __dirname + '/locales',
 fallbacks: true
 extension: '.js',
 defaultLocale: 'EN',
 is cookiename: 'lang',
 register: global,
 api: {
 '__': 't',
 '__n': 'tn'
}
});
app.use(function(req, res, next) {
 if(req.query.lang) {
req.i18n.setLocaleFromQuery();
 Res. cookie('lang', req.i18n.getLocale());
 } else {
req.i18n.setLocaleFromCookie();
}
next();
});
June 8th 19 at 17:05
1 answer
June 8th 19 at 17:07
Library i18n-2 cannot be used in reacte, it is only for nodi.
Find in library code.
Here is the piece of code that is responsible for reading the translation files:
var i18n = module.exports = function (opt) {
...
 if (opt.locales && opt.locales.forEach) {
 this.locales = {};
 opt.locales.forEach(function (locale) {
self.readFile(locale);
});
}
...
}

i18n.prototype = {
...
 readFile: function (locale) {
 var file = this.locateFile(locale);
...
 try {
 var localeFile = fs.readFileSync(file);
...
},
...
}
What is most interesting, the translation of the work {__('Home')}
and when ?lang=en translates without problems, but in the browser error Uncaught ReferenceError: __ is not defined
can advise normal react library?
to be able to cook to hang - audra.Lubowitz commented on June 8th 19 at 17:10
Sorry, I'm not familiar with REAKTOR, so nothing better than a link to npm can't give.
Let's see what there is and choose what you like. - jackeline.OConner commented on June 8th 19 at 17:13

Find more questions by tags Express.jsNode.jsReact