diff --git a/src/pages/thread/index.js b/src/pages/thread/index.js index 6b367e8..2b77268 100644 --- a/src/pages/thread/index.js +++ b/src/pages/thread/index.js @@ -99,13 +99,12 @@ class Thread extends React.Component { } render () { - let root = this.state.post.id - let isSingleComment = false + const { subreddit, id } = this.state.post + const { commentID } = this.props.match.params + const linkToRestOfComments = `/r/${subreddit}/comments/${id}/_/` - if (this.props.match.params.commentID !== undefined) { - root = this.props.match.params.commentID - isSingleComment = true - } + const isSingleComment = commentID !== undefined + const root = isSingleComment ? commentID : id return ( @@ -120,9 +119,9 @@ class Thread extends React.Component { /> {isSingleComment && -
+
you are viewing a single comment's thread.
- view the rest of the comments + view the rest of the comments
}