question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX macros aren't working inside JSX expressions in JSX macros

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
semoalcommented, Dec 9, 2021

Thx @khmm12 will take a look as soon as possible. Indeed looks a regression

0reactions
khmm12commented, Jun 17, 2022

Up

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found