Created
July 31, 2014 13:03
-
-
Save AGresvig/7d4f44a3f1bb51745228 to your computer and use it in GitHub Desktop.
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 React = require('react'); | |
module.exports = React.createClass({ | |
render: function() { | |
return ( | |
<div className="post"> | |
<h2 className="postName"> | |
ssdfsdf | |
{this.props.title} | |
</h2> | |
{this.props.children} | |
</div> | |
); | |
} | |
}); |
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 React = require('react'); | |
var PostHandler = module.exports = React.createClass({ | |
render: function() { | |
return ( | |
<div> | |
<h2>Post Section</h2> | |
<this.props.activeRouteHandler /> | |
</div> | |
); | |
} | |
}); |
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 React = require('react'); | |
var Post = require("./post.jsx"); | |
var posts = [ | |
{ | |
slugId: "post-one", | |
title: "Post One", | |
text: "Hey there this is post One!" | |
}, { | |
slugId: "post-two", | |
title: "Post two", | |
text: "Hey there this is post TWO ok!" | |
} | |
]; | |
module.exports = React.createClass({ | |
getInitialState: function(cb) { | |
return {posts: posts}; | |
}, | |
render: function() { | |
var postNodes = | |
this.state.posts.map(function(post) { | |
return <Post title={post.title}>{post.text}</Post>; | |
}); | |
return ( | |
<div> | |
<h2>Posts</h2> | |
<div className="postList"> | |
{postNodes} | |
</div> | |
</div> | |
); | |
} | |
}); |
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
<Routes> | |
<Route handler={App}> | |
<Route handler={PostHandler}> | |
<Route name="posts" handler={PostList}/> | |
<Route name="post" path="/post/:slugId" handler={Post}/> | |
</Route> | |
<Route name="about" handler={About}/> | |
</Route> | |
</Routes> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment