This code block gets read by HTML as bulleted comments, though they are text. Is there a shorter method to prevent them from being formatted as list elements than escaping “<” and “>?”
<pre><code>
{state.messages.map(element =>
<ul messags={element.messages} />);}
let listItems = messsages.map(item =>
<li>{item}</li>
);
<ul>
{this.state.messages.map(element =>
<li>{element}</li>)}
</ul>
</code></pre>
Right, I don’t know if there is a better way, but you can obscure the HTML elements by using escapes for the <
characters, with <
<pre>
{state.messages.map(element =>
<ul messags={element.messages} />);}
let listItems = messsages.map(item =>
<li>{item}</li>
);
<ul>
{this.state.messages.map(element =>
<li>{element}</li>)}
</ul>
</pre>
It does seem like escaping them is the way to obscure the elements in HTML. There are escape character converters for blocks of text.
system
Closed
October 14, 2021, 12:42am
4
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.