mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-23 23:34:21 +00:00
22 lines
726 B
TypeScript
22 lines
726 B
TypeScript
|
import * as React from "react"
|
||
|
import {ManagedResource} from "../hooks/useManagedViewSet"
|
||
|
import {WithChildren, WithResource} from "../types/ExtraTypes"
|
||
|
import {SophonResearchGroup} from "../types/SophonTypes"
|
||
|
|
||
|
|
||
|
const groupContext = React.createContext<ManagedResource<SophonResearchGroup> | undefined>(undefined)
|
||
|
const GroupContext = groupContext
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Hook to access the {@link groupContext}.
|
||
|
*/
|
||
|
export function useGroupContext(): ManagedResource<SophonResearchGroup> | undefined {
|
||
|
return React.useContext(groupContext)
|
||
|
}
|
||
|
|
||
|
|
||
|
export function GroupProvider({resource, children}: WithResource<SophonResearchGroup> & WithChildren): JSX.Element {
|
||
|
return <GroupContext.Provider value={resource} children={children}/>
|
||
|
}
|