[V3] Trans is eating up parent component
See original GitHub issueDescribe the bug I think that screenshots will explain my issue better…
this
renders to
but
this
renders to
So, it’s, somehow, eating the anchor element, wtf?
I am using the Trans from @lingui/macro.
Expected behavior It shouldn’t eat parent components
Additional context It’s a nextjs app with TS4 and node 14
- jsLingui version 3.0.20
- Babel version 7.7.7
- .babelrc
{
"env": {
"production": {
"presets": ["next/babel", "@emotion/babel-preset-css-prop"],
"plugins": ["emotion", "macros"]
},
"development": {
"presets": ["next/babel", "@emotion/babel-preset-css-prop"],
"plugins": [["emotion", { "sourceMap": true }], "macros"]
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
is there any way to access the parent component instance in ...
I've already built a transpiler that modifies the output jsx to achieve this. I do this by passing in parent={this} in all child...
Read more >How to pass data from child component to its parent in ReactJS
Following are the steps to pass data from child component to parent component: In the parent component, create a callback function.
Read more >Angular components: How to talk to your children and listen to ...
Open the app.component.html file and remove the content. We'll be replacing it with other stuff as we progress. Parent and child components.
Read more >Fears about HIV Transmission in Families with an HIV-Infected ...
Few studies have examined whether families with an HIV-infected parent experience fears about transmission to children and how they address ...
Read more >Understanding the Transgender Community
As trans people become more visible, we aim to increase understanding of our community among our friends, families, and society. What does it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure what version you use, but
Next.js
recommends to always use<a>
as a child of<Link>
. In fact, there several props to handle cases when child component renders<a>
on it’s own: https://nextjs.org/docs/api-reference/next/linkEDIT: Next.js should display a warning if you use string as a child of Link:
https://github.com/vercel/next.js/blob/1925ca039c11f8e8cb4d60f973861008e14bee01/packages/next/client/link.tsx#L298-L301
Anyway, glad we get to the bottom of this 👍
They both render a string.
The point is another one.
If Link has a text, it will render an anchor with text, otherwise it will just render the children component, weird stuff.
Not your problem. Infact, it was quite impossible that a child component like Trans could eat a parent, but I was wondering maybe the macro was doing something wrong… but no, Link fault.