News for hackers. Stuff that matters.
Re:Maud: A Rust macro for writing HTML by ghusbands on Tuesday June 07, 2022 @12:36PM (#31656852)
JSX has some questionable design limitations in it, though. Like, these work as expected:

  \<h1>Hello, world!\</h1>
  \<img alt="Hello, world!"/>
  \<h1>Hello, {place}!\</h1>
  \<img alt={message}/>
But this doesn't:

  \<img alt="Hello, {place}!"/>
And as other commenters note, it's designed around React internals, meaning you get rules around capitalisation that wouldn't otherwise exist. And so on.
Re:Maud: A Rust macro for writing HTML by centixel on Tuesday June 07, 2022 @02:26PM (#31658256)
I tend to solve that problem with either:

  <img alt={"Hello, " + place}/>
Or, for more complex interpolation:

  <img alt={`Hello, ${place}`}/>