8

I need to have something like

<p>{</p> // code <p>}</p> 

How can i use the curly parenthesis without it erroring and say expression needed? Is there an escape character that i can use? i.e. "\""

1

2 Answers 2

17

Well, this is a pretty solution. use the same curly brackets for display curly brackets.

 {'{'} {'}'} 
Sign up to request clarification or add additional context in comments.

2 Comments

I thought of that the moment I submitted the question. Thanks!
I think using @G4bri3l solution is a good choice. Over this concatenation.
5

I know there's already plenty of answers but just for completion, I recommend using semantic HTML, in this case I am talking specifically about the code tag (see docs here):

<code>{`{ hello }`}</code> 

You can use the backtick to avoid the use of many single or double quotes.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.