File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
packages/react/src/components Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+ import { UseSessionReturn } from '../hooks' ;
3+ import { RoomContext , SessionContext } from '../context' ;
4+ // NOTE: the below `useSession` is mentioned in a tsdoc comment
5+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6+ import { useSession } from '../hooks' ;
7+
8+ /** @public */
9+ export type SessionProviderProps = {
10+ session : UseSessionReturn ;
11+ children : React . ReactNode ;
12+ } ;
13+
14+ /**
15+ * The `SessionProvider` component instantiates a SessionContext from the return of {@link useSession}
16+ * @public
17+ */
18+ export function SessionProvider ( props : SessionProviderProps ) {
19+ return (
20+ < SessionContext . Provider value = { props . session } >
21+ < RoomContext . Provider value = { props . session . room } > { props . children } </ RoomContext . Provider >
22+ </ SessionContext . Provider >
23+ ) ;
24+ }
You can’t perform that action at this time.
0 commit comments