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