Промежуточный этап синхронизации
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { useContext } from "react";
|
||||
import { ProtocolContext } from "./ProtocolProvider";
|
||||
import { ProtocolContext, ProtocolContextType, ProtocolState } from "./ProtocolProvider";
|
||||
|
||||
export const useProtocolState = () => {
|
||||
const [context, connect] = useContext(ProtocolContext);
|
||||
const context : ProtocolContextType = useContext(ProtocolContext);
|
||||
|
||||
if(!context){
|
||||
throw new Error("useProtocol must be used within a ProtocolProvider");
|
||||
}
|
||||
|
||||
return connect;
|
||||
return [context[1], context[2]] as [ProtocolState, (state: ProtocolState) => void];
|
||||
};
|
||||
Reference in New Issue
Block a user