Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX variable references do not work as children on lines with plain text #994

Closed
Lugribossk opened this issue Mar 28, 2020 · 2 comments
Closed
Labels

Comments

@Lugribossk
Copy link

Subject of the issue

JSX references to Javascript variables with {} do not work as children of a component or tag when on a line with other plain text.

Your environment

  • OS: Windows 10
  • Packages: "@mdx-js/mdx": "1.5.8",
    "@mdx-js/parcel-plugin-mdx": "1.5.8",
    "@mdx-js/react": "1.5.8",
  • Env: Node.js v12.13.0, yarn v1.22.4

Steps to reproduce

Rendering this example:

export const name = "world";
export const color = "red";

Hello <span style={{color: color}}>{name}</span>
<span style={{color: color}}>Hello {name}</span>

Will produce:

Hello {name}
Hello world

However referencing the color variable does work to change the text color on both lines.

Expected behaviour

I would expect both lines to render "Hello world".

Actual behaviour

The variable reference is rendered as text instead.

@Lugribossk Lugribossk added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Mar 28, 2020
@wooorm
Copy link
Member

wooorm commented Apr 14, 2020

Correct, those aren’t working. It’s being discussed here: #994

@wooorm wooorm closed this as completed Apr 14, 2020
@wooorm wooorm added 👯 no/duplicate Déjà vu and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Apr 14, 2020
@RadxaYuntian
Copy link

#994 is a self-reference. The related issue is probably #556.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants