3 ms·
JSX has some questionable design limitations in it, though. Like, these work as expected: \<h1>Hello, world!\</h1> \<img alt="Hello, world!"/> \<h1>Hello
by ghusbands 4y 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.
- centixel 4y agoI tend to solve that problem with either: <img alt={"Hello, " + place}/> Or, for more complex interpolation: <img alt={`Hello, ${place}`}/>