React Facebook

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

HookDescription
useLoginHandle Facebook login and logout with automatic loading and error state management
useProfileFetch the logged-in user's Facebook profile with automatic data loading
useLoginStatusMonitor the user's Facebook login status in real time
useGraphAPIMake Facebook Graph API calls with automatic loading, error, and data state management
useShareShare content via the Facebook Share dialog
useFeedPost to a user's feed via the Facebook Feed dialog
useSendSend messages via the Facebook Send dialog
useFacebookAccess the Facebook SDK context, including the API instance, initialization, and locale management
useLocaleManage Facebook SDK locale dynamically with support for 40+ languages
useSubscribeSubscribe to Facebook SDK events with automatic cleanup

On this page