Hacker News new | ask | show | jobs
by ghusbands 1472 days ago
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.
1 comments

I tend to solve that problem with either:

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

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