Components
React components for Facebook SDK integration
Components
React Facebook provides a set of declarative React components for embedding Facebook social plugins and UI elements. Components handle SDK initialization, XFBML parsing, and re-rendering automatically so you can add Facebook features with minimal boilerplate.
All components must be rendered inside a <FacebookProvider>, which initializes the Facebook SDK and provides context to the component tree.
Available Components
| Component | Description |
|---|---|
FacebookProvider | Initializes the Facebook SDK and provides context to all child components and hooks |
Login | Unified Facebook login component supporting button rendering, render props, and custom elements |
Like | Renders a Facebook Like button via the XFBML social plugin |
Share | Renders a Facebook Share button via the XFBML social plugin |
ShareButton | A customizable button that opens the Facebook Share dialog using the JavaScript SDK |
Comments | Renders the Facebook Comments plugin for any URL |
CommentsCount | Displays the number of Facebook comments for a given URL |
EmbeddedPost | Embeds a public Facebook post on your page |
EmbeddedVideo | Embeds a public Facebook video on your page |
Page | Embeds a Facebook Page plugin showing timeline, events, and messages |
FacebookErrorBoundary | Error boundary that catches Facebook SDK errors from ad blockers, network failures, and initialization issues |
FacebookPixelProvider | Standalone provider for Facebook Pixel tracking without the full Facebook SDK |