Hooks
React hooks for Facebook SDK integration
Hooks
React Facebook provides a comprehensive set of hooks for programmatic interaction with the Facebook SDK. Hooks give you fine-grained control over login flows, data fetching, sharing dialogs, event tracking, and more -- all with built-in loading and error state management.
All hooks listed below must be used inside a <FacebookProvider> (or, for pixel hooks, a <FacebookPixelProvider>).
Available Hooks
| Hook | Description |
|---|---|
useLogin | Handle Facebook login and logout with automatic loading and error state management |
useProfile | Fetch the logged-in user's Facebook profile with automatic data loading |
useLoginStatus | Monitor the user's Facebook login status in real time |
useGraphAPI | Make Facebook Graph API calls with automatic loading, error, and data state management |
useShare | Share content via the Facebook Share dialog |
useFeed | Post to a user's feed via the Facebook Feed dialog |
useSend | Send messages via the Facebook Send dialog |
useFacebook | Access the Facebook SDK context, including the API instance, initialization, and locale management |
useLocale | Manage Facebook SDK locale dynamically with support for 40+ languages |
useSubscribe | Subscribe to Facebook SDK events with automatic cleanup |