I'm following the common pattern of breaking multi-attribute tags on to multiple lines, eg.
<div
className="foo"
style={{ fontWeight: "bold" }}
/>
I would like to add a comment inside that declaration, eg.
<div
className="foo"
{/* This is only temporary */}
style={{ fontWeight: "bold" }}
/>
However the above syntax doesn't work; I get:
SyntaxError: Unexpected token, expected ... (45:96)
(pointing to the closing }
in temporary */}
.)
Is it possible to add a comment inside a tag in JSX, and if so what syntax should I use?