Guides / Get started - Get started with React
This guide assumes that you're already familiar with React.
Alternatively, you can copy this example and follow the instructions in the README:
Run the following command to install Liveblocks packages:
To connect to Liveblocks, you should use the
LiveblocksProvider at the root of your React app. This component wraps all the pages of your website and allows you to use the Liveblocks hooks in any React component.
Liveblocks should now be installed into your project!
A room is the virtual space where people collaborate. To create a multiplayer experience, you’ll need to connect your users to a Liveblocks room following the instructions below.
You can easily connect to a room by using
RoomProvider inside your
App.js React component as shown below.
Now that we have our room setup, we can start using the Liveblocks React hooks to share any kind of data between users. For instance,
useOthers allows us to list all the people that are currently connected to the room.
Using the public key allows you to use Liveblocks without implementing your own authentication endpoint. It’s great for prototyping and marketing websites.
If you want to implement your own security and define if the current user has access to a specific room, you can follow the Authentication guide.
If you are using Next.js, you can also check the Next.js Authentication guide.
Explore our examples below to see what you can do with Liveblocks.