Daniel Zuzevich Daniel Zuzevich - 1 year ago 99
Javascript Question

React Curly Brace Issue

Embarassing, but I cannot figure out how to write something fairly basic in React with JSX. I have looked online, and here as well, but nothing helped. I also took a look into the official React documents, but even when they are explaining basic things, it seems like an alien is explaining it to me.

I literally just want a basic j query function with all of its syntax to appear on the screen, but it keeps hiding one of my brackets.

$('#btn').click(function() your code here });

As you can see, it takes the other curly brace out. I am in no means attempting to execute any jQuery, this is supposed to show the function to explain how it works to someone.

Answer Source

<div>{"$('#btn').click(function() { your code here });"}</div>


or you can save it to a variable

var jQueryExample = "$('#btn').click(function() { your code here });"

render() { return <div>{jQueryExample}</div> }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download