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

Inline Do in JSX is not parsed #61

Closed
d3dc opened this issue Feb 7, 2018 · 1 comment
Closed

Inline Do in JSX is not parsed #61

d3dc opened this issue Feb 7, 2018 · 1 comment

Comments

@d3dc
Copy link

d3dc commented Feb 7, 2018

I like to use do blocks to avoid hard to read binary operators.

<Component>
  { do {
     if (cond) {
       childrenA
     } else {
       childrenB
     }
  }}
</Component>

but this doesn't seem to be recognized in FJSX15+


Something as simple as:

  <div>
    <Parsable />
    { do { 1 + 1 }}
  </div>

fails

Oddly, if statements are partially recognized.

In this code:

<div>
  {do {
    if (condition) {
      1 + 1
    } else {
      2 + 2
    }
  }}
</div>

the true branch is parsed.

screen shot 2018-02-07 at 3 20 03 pm

@borela
Copy link
Owner

borela commented Feb 7, 2018

Released the patch https://github.com/borela/naomi/releases/tag/v3.3.6

The {} inside JSX expect expressions and "Do" expressions were being ignored; I added an exclusive clause to prevent that and now it has the added benefit of distinguishing do expressions from do loops.

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

No branches or pull requests

2 participants