Skip to content

How do we turn on and off room provider? #477

Answered by FlowFlorent
kachar asked this question in Help
Discussion options

You must be logged in to vote

Hello @kachar,

Thanks for the question and kind words!

Here's what I understand from your use case, let me know if any of it is wrong.

  1. You have a component that is nested under which is your live component, it uses tools from @liveblocks/react and @liveblocks/client
  2. You want to first have a display version of that component when users go to that page that is not yet connected to any Room.

Have you thought about using a substitution UI when you do not want to have it connected?

isConnected ? 
(
    <RoomProvider>
        <MyComponent />
    </RoomProvider>
) :
<MyComponent />

Where <MyComponent /> can work in both instances?
Or perhaps a <MyDisplayComponent /> when isConnected === false

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@kachar
Comment options

@kachar
Comment options

@GuillaumeSalles
Comment options

@kachar
Comment options

Answer selected by kachar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants