compiler icon indicating copy to clipboard operation
compiler copied to clipboard

JSX expression error when using <=

Open hfournier opened this issue 1 year ago • 0 comments

Astro Info

Astro                    v3.5.5
Node                     v18.17.1
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

The following code block results in an error: "Unable to assign attributes when using <> Fragment shorthand syntax!"

{
  mydata.length <= 10 && (
    <ul>
      {mydata.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  )
}

changing the expression to mydata.length < 10 works as expected, so having <= is causing the issue.

What's the expected result?

The JSX expressions should be evaluated and not interpreted as fragments.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-foh8kw?file=src%2Fpages%2Findex.astro

Participation

  • [ ] I am willing to submit a pull request for this issue.

hfournier avatar Nov 20 '23 23:11 hfournier