Get started - Get started with Notifications using Liveblocks and React
Liveblocks is a realtime collaboration infrastructure for building performant
collaborative experiences. Follow the following steps to start adding
notifications to your application using the hooks from
@liveblocks/react
and the components
from @liveblocks/react-ui
.
Quickstart
Install Liveblocks
Every package should use the same version.
Initialize the
liveblocks.config.ts
fileWe can use this file later to define types for our application.
Set up the Liveblocks client
Liveblocks uses the concept of rooms, separate virtual spaces where collaborate, and to create a realtime experience, multiple users must be connected to the same room. Set up a Liveblocks client with
LiveblocksProvider
.App.tsxUse the Liveblocks hooks and components
Now that we’ve set up the provider, we can start using the Liveblocks hooks and components. We’ll add
useInboxNotifications
to get the current project’s notifications, then we’ll useInboxNotification
andInboxNotificationList
to render them.app/MyApp.tsxImport default styles
The default components come with default styles, you can import them into the root of your app or directly into a CSS file with
@import
.Next: authenticate and add your users
Notifications is set up and working now, but each user is anonymous—the next step is to authenticate each user as they connect, and attach their name and avatar to their notifications.
Add your users to Notifications
What to read next
Congratulations! You’ve set up the foundation to start building a notifications experience for your React application.