
์ธ์ด ๐ฐ๐ท ํ๊ตญ์ด
๋ฌธ์
์์ํ๊ธฐ
์ฌ์ฉ๋ฒ
Add Comments to Your React App
FastComments์ฉ ๊ณต์ React ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
React ์ฑ์ ์ค์๊ฐ ๋๊ธ, ์ฑํ ๋ฐ ๋ฆฌ๋ทฐ ์์ ฏ์ ์ฝ์ ํ์ธ์.
๋ฆฌํฌ์งํ ๋ฆฌ
๋ผ์ด๋ธ ๋ฐ๋ชจ 
๋ชจ๋ ์์ ฏ์ ์ค์๊ฐ์ผ๋ก ํ์ธํด ๋ณด์ธ์ https://fastcomments.com/commenting-system-for-react.
๋ผ์ด๋ธ ์ผ์ผ์ด์ค 
๊ณต๊ฐ demo ํ
๋ํธ์ ๋ํด ๋ก์ปฌ์์ ์คํ ์ค์ธ ๋ชจ๋ ์์ ฏ๊ณผ ํ๋ก์ฐ๋ฅผ ๋ณด๋ ค๋ฉด, ์ ์ฅ์๋ฅผ ํด๋ก ํ ํ ๋ค์์ ์คํํ์ธ์:
cd examples/example-showcase
npm install
npm start
๊ฐ ์์ ฏ/ํ๋ก์ฐ๋ examples/example-showcase/src/views/ ์๋์ ๊ฐ๊ฐ์ ๋ทฐ๊ฐ ์์ผ๋ฉฐ, ์ด๋ฅผ ๊ทธ๋๋ก ๋ณต์ฌํ์ฌ ์์ ์ React ์ฑ์ ๋ถ์ฌ๋ฃ์ ์ ์์ต๋๋ค.
์์ 
๊ฐ๋ณ ์ฌ์ฉ ์ฌ๋ก(๋คํฌ ๋ชจ๋, ํ์ด์ง๋ค์ด์
๋ฑ)์ examples/ ์๋์ ๊ฐ ํด๋์ ์์ต๋๋ค. ๊ฐ๊ฐ์ npm install๋ก ์ค์ ํ ๋ค์ npm start๋ก ์์ํ ์ ์์ต๋๋ค.
์ฌ์ฉ๋ฒ 
๋ฉ์ธ ์์ ฏ ์ปดํฌ๋ํธ
The FastCommentsCommentWidget ์ปดํฌ๋ํธ์๋ ๋ผ์ด๋ธ FastComments ๋๊ธ ์์ ฏ์ด ํฌํจ๋์ด ์์ต๋๋ค.
์๋์ "demo"๋ฅผ FastComments ๊ด๋ฆฌ์ ์์ญ์ ์ฌ๊ธฐ์์ ํ์ธ ๊ฐ๋ฅํ ๋น์ ์ "tenantId"๋ก ๋ฐ๊พธ์ธ์.
์์ ฏ์ ๋ง์ ์ต์ ์ ์ง์ํฉ๋๋ค - ์ง์๋๋ ์ค์ ์ src/index.tsx์ FastCommentsCommentWidgetConfig๋ฅผ ์ฐธ์กฐํ์ธ์.
import React, { Component } from 'react'
import {FastCommentsCommentWidget} from 'fastcomments-react'
class Example extends Component {
render() {
return <FastCommentsCommentWidget tenantId="demo" />
}
}
ํ์ฌ ํ์ด์ง ์ ๋ฐ์ดํธ (SPA์ฉ)
๋๊ธ ์ค๋ ๋๊ฐ ์ฐ๊ฒฐ๋ ํ์ด์ง/๊ธฐ์ฌ ์ ๋ณด๋ฅผ ์ ๋ฐ์ดํธํ๋ ค๋ฉด ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์ "urlId"์ "url"์ ์ ๋ฐ์ดํธํด์ผ ํฉ๋๋ค. ์์ ์ ์ค๋ช ์ ์ฌ๊ธฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
๊ณ์ ์ง์ญ (์ฃผ์: EU ๊ณ ๊ฐ)
EU์ ๊ณ์ ๊ฒฝ์ฐ, ํด๋ผ์ด์ธํธ ์์ ฏ์ ์ด๋ ์ง์ญ์ ์๋์ง ์๋ ค์ฃผ์ด์ผ ํฉ๋๋ค. examples/example-eu๋ฅผ ์ฐธ์กฐํ์ธ์;
๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ region์ ์ ์ํ ํ์๊ฐ ์์ต๋๋ค.
๋๊ธ ์นด์ดํธ ์์ ฏ
The FastCommentsCommentCountWidget ์ปดํฌ๋ํธ์๋ ๋ผ์ด๋ธ FastComments ๋๊ธ ์ ์์ ฏ์ด ํฌํจ๋์ด ์์ต๋๋ค.
์๋์ "demo"๋ฅผ FastComments ๊ด๋ฆฌ์ ์์ญ์ ์ฌ๊ธฐ์์ ํ์ธ ๊ฐ๋ฅํ ๋น์ ์ "tenantId"๋ก ๋ฐ๊พธ์ธ์.
์ง์๋๋ ๊ตฌ์ฑ ์ต์ ์ src/index.tsx์ FastCommentsCommentCountConfig๋ฅผ ์ฐธ์กฐํ์ธ์.
import React, { Component } from 'react'
import {FastCommentsCommentCountWidget} from 'fastcomments-react'
class Example extends Component {
render() {
return <FastCommentsCommentCountWidget tenantId="demo" urlId="https://example.com/some-page-or-id" />
}
}
๋ค์ดํฐ๋ธ
FastComments๋ฅผ ์์ ํ ๋ค์ดํฐ๋ธ๋ก ๊ตฌํํ๋ ค๋ฉด fastcomments-react-native-sdk๋ฅผ ์ฐธ์กฐํ์ธ์.
์น๋ทฐ๋ฅผ ์ฌ์ฉํ๋ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ React Native ๋ํผ๋ fastcomments-react-native๋ฅผ ์ฐธ์กฐํ์ธ์.
์ ์ง๋ณด์ ์ํ 
์ด ๊ตฌ์ฑ ์์๋ค์ ์ ํฌ์ ํต์ฌ VanillaJS ๊ตฌ์ฑ ์์๋ค์ ๊ฐ์ธ๋ ๋ํผ์ ๋๋ค. ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ฐฐํฌํ์ง ์๊ณ ๋ ์ด๋ฌํ ๊ตฌ์ฑ ์์๋ค์ ์๋์ผ๋ก ์ ๋ฐ์ดํธ(๋ฒ๊ทธ ์์ , ๊ธฐ๋ฅ ์ถ๊ฐ)ํ ์ ์์ผ๋ฏ๋ก, ๋น๋ถ๊ฐ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๊ฒ์๋์ง ์๋๋ผ๋ ๊ทธ๋ ๋ค๊ณ FastComments์ ๊ฐ๋ฐ์ด ์ค๋จ๋์๋ค๋ ๋ป์ ์๋๋๋ค! ์ ๋ฐ์ดํธ๋ ์ ํฌ ๋ธ๋ก๊ทธ์์ ํ์ธํ์ธ์. ์ค๋ํ API ๋ณ๊ฒฝ์ด๋ ๊ธฐ๋ฅ์ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๋ฒ์ ์ด ์ฌ๋ผ๊ฐ์ง ์๋ ํ ๊ธฐ๋ณธ ์ฝ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ๋ ๋ฐ์๋์ง ์์ต๋๋ค.
๋์ ํ์ํ์ ๊ฐ์?
React ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ด๋ จํ์ฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ์ง๋ฌธ์ด ์๋ ๊ฒฝ์ฐ, ๋ค์์ ์ด์ฉํด ์ฃผ์ธ์:
๊ธฐ์ฌ
๊ธฐ์ฌ๋ ํ์ํฉ๋๋ค! ๊ธฐ์ฌ ์ง์นจ์ GitHub ์ ์ฅ์๋ฅผ ๋ฐฉ๋ฌธํด ์ฃผ์ธ์.