Skip to content

Commit

Permalink
Implements a NoSSR block
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoda committed Feb 19, 2016
1 parent 40d76fe commit 3d2d52d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/components/comments.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

export const Waiting = () => (
<div>
Waiting for comments ...
</div>
);

const Comments = () => (<div>
No comments yet!
</div>);

export default Comments;
8 changes: 8 additions & 0 deletions app/components/post_page.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import React from 'react';
import NoSSR from 'react-no-ssr';
import Comments from './comments.jsx';
import { Waiting } from './comments.jsx';

const PostPage = ({post}) => (
<div>
<a href={FlowRouter.path('/')}>Back</a>
<h3>{post.title}</h3>
<p>{post.content}</p>
<hr />

<NoSSR onSSR={<Waiting />}>
<Comments />
</NoSSR>
</div>
);

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"react": "^0.14.6",
"react-dom": "^0.14.6",
"react-komposer": "^1.3.0",
"react-mounter": "^1.1.0"
"react-mounter": "^1.1.0",
"react-no-ssr": "^1.0.1"
},
"private": true
}
5 changes: 5 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ h1 {
#logout {
margin-left: 10px;
}

hr {
border: 0px;
border-bottom: 1px solid #DDD;
}

0 comments on commit 3d2d52d

Please sign in to comment.