Skip to content

Instantly share code, notes, and snippets.

@jergason
Forked from fivetanley/foo.html
Last active August 29, 2015 14:06
Show Gist options
  • Save jergason/f85276e1b3f8bbf6f867 to your computer and use it in GitHub Desktop.
Save jergason/f85276e1b3f8bbf6f867 to your computer and use it in GitHub Desktop.
/** @jsx: React.DOM */
var React = require('react');
var IfThingy = React.createClass({
render: function() {
var ifThingy;
if (this.props.someVar) {
ifThingy = <h1>Some Var Is {this.props.someVar}</h1>;
}
else {
ifThingy = <h1>Some var is falsy :(</h1>;
}
return <div>
{ifThingy}
</div>
}
})
@jergason
Copy link
Author

Since you represent the DOM with js objects, you just use javascript for your control flow. You don't do any icky matching brackets or anything. It's Just JavaScript!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment