Niall Niall - 1 year ago 92
React JSX Question

How to output php code block in reactjs?

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?

Answer Source

Wrap your code with ` like

{`if(isset($_POST['user')){//do something}`}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download