-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post, Comment 컴포넌트 분리 및 Lazy load 적용 #64
포스트 페이지 로드에 disqus 생성이 함께 되면서 느림, 따라서 스크롤을 하여 포스트 내용의 아래에 도달하게 된 시점에 React.lazy를 이용하여 컴포넌트를 불러오게 되는 방식으로 개선
- Loading branch information
Showing
2 changed files
with
89 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react'; | ||
import { DiscussionEmbed } from 'disqus-react'; | ||
import config from '../../../_config'; | ||
|
||
interface CommentProps { | ||
slug: string; | ||
title: string; | ||
} | ||
|
||
const Comment = ({ slug, title }: CommentProps) => { | ||
console.log('Comment'); | ||
|
||
const disqusConfig = { | ||
shortname: config.disqusShortname, | ||
config: { | ||
url: `${config.siteUrl + slug}`, | ||
identifier: slug, | ||
title, | ||
}, | ||
}; | ||
|
||
return ( | ||
<div className="comments"> | ||
<DiscussionEmbed {...disqusConfig} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Comment; |
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