Skip to content

Commit

Permalink
This could be a good base for starters
Browse files Browse the repository at this point in the history
  • Loading branch information
sahanDissanayake committed Apr 18, 2016
1 parent 366b235 commit ce1383f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 1 addition & 3 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ [email protected]
[email protected]
[email protected]
chuangbo:[email protected]
[email protected]
cosmos:[email protected]
[email protected]
[email protected]
[email protected]
Expand All @@ -38,7 +36,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
kadira:dochead@1.4.0
kadira:dochead@1.5.0
kadira:[email protected]
[email protected]
[email protected]
Expand Down
19 changes: 19 additions & 0 deletions imports/app/components/post.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

class Post extends React.Component {
render() {
var {_id, title} = this.props;
console.log( _id, title );
return (
<li key={_id}>
<a href={FlowRouter.path('post', this.props)}>{title}</a>
</li>
)
}

componentDidMount() {
console.log('hello');
}
}

export default Post;
29 changes: 17 additions & 12 deletions imports/app/components/post_list.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from 'react';
import Post from './post.jsx';

const PostList = ({posts}) => (
<div>
This is the post list
<ul>
{posts.map(({_id, title}) => (
<li key={_id}>
<a href={FlowRouter.path('post', {_id})}>{title}</a>
</li>
))}
</ul>
</div>
);
class PostList extends React.Component {
render() {
return <div>
This is the post list
<ul>
{this.props.posts.map(({_id, title}) => (
<Post key={_id} _id={_id} title={title} />
))}
</ul>
</div>
}

componentDidMount() {
console.log('hello');
}
}

export default PostList;
8 changes: 0 additions & 8 deletions imports/app/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ FlowRouter.route("/", {
}
});

FlowRouter.route('/post/:_id', {
name: 'post',
action(params) {
mount(BlogLayout, {
content: <PostPage _id={params._id} />
});
}
});
12 changes: 6 additions & 6 deletions node_modules/react-dom/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions node_modules/react/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
"name": "meteor-data-and-react",
"version": "0.0.0",
"dependencies": {
"react": "^0.14.6",
"react-dom": "^0.14.6",
"react": "^0.14.8",
"react-addons-create-fragment": "^15.0.1",
"react-addons-css-transition-group": "^15.0.1",
"react-addons-linked-state-mixin": "^15.0.1",
"react-addons-perf": "^15.0.1",
"react-addons-pure-render-mixin": "^15.0.1",
"react-addons-test-utils": "^15.0.1",
"react-addons-transition-group": "^15.0.1",
"react-addons-update": "^15.0.1",
"react-dom": "^0.14.8",
"react-komposer": "^1.3.0",
"react-mounter": "^1.1.0",
"react-no-ssr": "^1.0.1"
Expand Down
1 change: 1 addition & 0 deletions server/publications.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Meteor.publish('posts', () => {

Meteor.publish('singlePost', _id => {
check(_id, String);
// Meteor._sleepForMs(2000);
return Posts.find({_id});
});

0 comments on commit ce1383f

Please sign in to comment.