Created
March 9, 2014 17:41
-
-
Save insin/9451422 to your computer and use it in GitHub Desktop.
"Template" component in React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AddContact = React.createClass({ | |
render: function() { | |
return <form ref="form"> | |
<h2>Add {this.props.type}</h2> | |
{this.props.children} | |
<div>Phone Fields</div> | |
<div>Email Fields</div> | |
<div>Address Fields</div> | |
</form> | |
} | |
}) | |
var AddPerson = React.createClass({ | |
render: function() { | |
return this.transferPropsTo(<AddContact type="Person"> | |
<div>Person Fields</div> | |
</AddContact>) | |
} | |
}) | |
var AddOrganisation = React.createClass({ | |
render: function() { | |
return this.transferPropsTo(<AddContact type="Organisation"> | |
<div>Organisation Fields</div> | |
</AddContact>) | |
} | |
}) | |
var App = React.createClass({ | |
render: function() { | |
return <div> | |
<AddPerson/> | |
<AddOrganisation/> | |
</div> | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment