React Facebook

CommentsCount

Displays the number of Facebook comments for a given URL.

The CommentsCount component renders a <span> that the Facebook SDK populates with the comment count for the specified URL. It uses the fb-comments-count XFBML class.

Import

import { CommentsCount } from 'react-facebook';

Props

PropTypeDefaultDescription
hrefstringCurrent page URLThe URL whose comment count should be displayed.
classNamestring''Additional CSS class names appended to the <span>.

Usage

Basic

<CommentsCount href="https://example.com/post" /> comments

Styled

<p>
  This post has <CommentsCount href="https://example.com/post" className="font-bold text-blue-600" /> comments.
</p>

On this page