Typescript error when importing Trans component #1160
-
Hey! Just by importing the Trans component from @lingui/macro, I get the following error:
Importing the same from @lingui/react works, but I prefer to use the children prop, so any ideas? EDIT: I've uploaded the project to codesandbox, for more context: https://codesandbox.io/s/d27fv?file=/src/components/Navbar/Navbar.tsx It might be something dumb, but I've been trying to fix it very hard and in many different ways, so help would be greatly appreciated :') |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hola! First thing I saw in your codesandbox, is that babelrc is not correct. Second thing: Third thing: You can check our example in Anyways, feel free to reach me out through Discord and I'll help you more in detail if needed Saludos!! |
Beta Was this translation helpful? Give feedback.
Hola!
First thing I saw in your codesandbox, is that babelrc is not correct.
babel-preset-env
andbabel-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 anindex.tsx
and is not wrapping the<App />
component with theI18nProvider
that makes@lingui
global.You can check our example in
examples/create-react-app
which uses create-react-app and find the main difference…