JSX macros aren't working inside JSX expressions in JSX macros
See original GitHub issueDescribe the bug
Since v3 JSX macros aren’t working inside JSX expressions in JSX macros. v2 macros are working as expected.
The issue is reproducible in any nesting level.
To Reproduce
import { Trans } from '@lingui/macro'
export default function Component(props) {
return <Trans>Hello, {props.world ? <Trans>world</Trans> : <Trans>guys</Trans>}</Trans>
}
Expected behaviour
import { Trans } from '@lingui/react'
export default function Component(props) {
return (
<Trans
id='Hello, {0}'
values={{
0: props.world ? <Trans id='world' /> : <Trans id='guys' />
}}
/>
)
}
Actual behaviour
import { Trans } from '@lingui/react'
export default function Component(props) {
return (
<Trans
id='Hello, {0}'
values={{
0: props.world ? <Trans>world</Trans> : <Trans>guys</Trans>
}}
/>
)
}
Additional context
lingui
:3.13.0
@babel/core
:7.16.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Support comments inside JSX macros by ignoring ... - GitHub
Describe the bug When using a element with a nested element like {/* This is a comment */}, it complains of @lingui/macro: Property...
Read more >dynamic File inside folders not reading with React and preval ...
1 Answer 1 ; React, { useState } from "react"; ; import preval from "preval.macro"; ; import shortid from "shortid"; ...
Read more >Experimenting with JSX has introduced me to two language ...
In LISP based languages like ClojureScript, macros are part of the language. No need to build tools like JSX (that requires to run...
Read more >JSX In Depth - React
The first part of a JSX tag determines the type of the React element. Capitalized types indicate that the JSX tag is referring...
Read more >@lingui/macro - Reference — LinguiJS documentation
@lingui/macro package provides babel macros which transforms JavaScript objects and JSX elements into messages in ICU MessageFormat.
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 FreeTop 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
Top GitHub Comments
Thx @khmm12 will take a look as soon as possible. Indeed looks a regression
Up