Skip to content

Typescript error when importing Trans component #1160

Answered by semoal
jesuslencina asked this question in Q&A
Discussion options

You must be logged in to vote

Hola!

First thing I saw in your codesandbox, is that babelrc is not correct.
babel-preset-env and babel-prest-react are deprecated and shouldn't be used. In favor is @babel/preset-env and @babel/preset-react, create-react-app by default works out of the box with Lingui you don't need to modify any babel config.

Second thing: @lingui/macro package is not in the dependencies section and @lingui/core is required also. Make sure to get it installed.

Third thing: index.js should be an index.tsx and is not wrapping the <App /> component with the I18nProvider that makes @lingui global.

You can check our example in examples/create-react-app which uses create-react-app and find the main difference…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jesuslencina
Comment options

Answer selected by jesuslencina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants