import { Dispatch, SetStateAction, createContext, useState, useContext, } from "react"; export type SelectionType = "address" | "value" | "functionSig"; export type Selection = { type: SelectionType; content: string; }; export type OptionalSelection = Selection | null; export const useSelection = (): [ OptionalSelection, Dispatch> ] => { return useState(null); }; export const SelectionContext = createContext>( null! ); export const useSelectionContext = () => { return useContext(SelectionContext); };