0

I've been searching for the past hour for an answer to this and I can't seem to find one. I want to output a php or javascript code example to my page so that the user can see example code. However, I can't do this using reactJs and jsx because it causes an error.

So this is an example if the kind of code I want to be seen on the screen.

if(isset($_POST['user')){//do something}

How can I output this in jsx? Can anyone shed some light on how I could do this?

1 Answer 1

1

Wrap your code with ` like

{`if(isset($_POST['user')){//do something}`}
Sign up to request clarification or add additional context in comments.

2 Comments

This works, provided that it's wrapped in curly braces.
The curly brackets is a fairly important part.. Shuja can you add them to your answer for the next person who comes across this post and I will accept it. Thanks to both of ye.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.