import { useContext } from "react"; import { ProtocolContext } from "./ProtocolProvider"; export const useProtocol = () => { const [context, connect] = useContext(ProtocolContext); if(!context){ throw new Error("useProtocol must be used within a ProtocolProvider"); } const protocol = context; return {protocol, protocolState: connect }; };