React/JSX/HTML: How to put a greater-than or less-than symbol in React/JSX/HTML

Published: 2019-10-28 17:19:58 -0400 -0400

Reading time: 1 mins (87 words)

Tags: react jsx html tutorial

problem

I’m building a web page in React / JSX and need to put a greater-than (>) and less-than (<) symbol in my page. How can I do this without the page breaking?

solution

You can wrap your symbols in a code block and insert them as a string!

Example:

<div>{"<"} Less than, {">"} greater than </div>

did this help?

I regularly post about tech topics I run into. You can get a periodic email containing updates on new posts and things I’ve built by subscribing here.

About the Ham

Hi I'm Hamilton and I wrote / built this! I like doing lots of things, but mostly I like to build (and then share those buildings). Some things I'm currently building: art, software, and prose. To stay up-to-date with my latest buildings, subscribe to my email list or follow one of my many other accounts. #buildit #shipit #justhamit

comments powered by Disqus