'How to display code "< />" as plain text in React?

I want to display < /> as plain text on my react page. I tried <code> </code> and I have also tried using &lt &gt but it doesn't work. Does anyone know how to do it? Many thanks



Solution 1:[1]

You can render it as a string as follows:

<p>{"</>"}</p>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shubham Waje