12 lines
364 B
TypeScript
12 lines
364 B
TypeScript
import { useContext } from "react";
|
|
import { TransportContext } from "./TransportProvider";
|
|
|
|
export function useTransportServer() {
|
|
const context = useContext(TransportContext);
|
|
if(!context){
|
|
throw new Error("useTransportServer must be used within a TransportProvider");
|
|
}
|
|
const { transportServer } = context;
|
|
|
|
return transportServer;
|
|
} |