Created
March 5, 2016 05:46
-
-
Save shunjikonishi/58a9df5507fa2cdd5008 to your computer and use it in GitHub Desktop.
React Child example
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
"use strict"; | |
var React = require("react"); | |
var Link = require('react-router').Link; | |
var Tabs = React.createClass({ | |
render: function() { | |
return ( | |
<div> | |
<ul> | |
{this.props.children} | |
</ul> | |
</div> | |
); | |
} | |
}); | |
var TabItem =React.createClass({ | |
propTypes: { | |
to: React.PropTypes.string.isRequired, | |
params: React.PropTypes.object | |
}, | |
render: function() { | |
return ( | |
<li> | |
<Link to={this.props.to} params={this.props.params}>{this.props.children}</Link> | |
</li> | |
); | |
} | |
}); | |
module.exports = { | |
Tabs: Tabs, | |
TabItem: TabItem | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment