How can I render a component inside a HTML
<code>
element just as a text?
<code>
<DesktopHeader>
<a href="/projects">Projects</a>
</DesktopHeader>
</code>
In my situation it renders my component again but I want to use it inside a documentation to just show how to pass props to a component.
This is not a perfect matchup for what you intend to do but you can escape your markups with
<
for <
, >
for >
, "
for "
(quotes), and also
for
(spaces).
So it will become something like this:
<code> <DesktopHeader><br/> <a href="/projects">Projects</a><br/> </DesktopHeader> </code>
NOTE: Generally every character with an UTF-8 code above 127 is not interchangeable between the "normal" Western ISO-8859-1 encoding and UTF-8. But to creating HTML markups knowing these three ( <
, >
,
, and "
) would be enough. I'm also found a link that can be useful for generating markups automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.