import * as React from "react";
import {SelectContext} from "../context/SelectContext";

export function useSelect() {
    const context = React.useContext(SelectContext);

    if (!context) {
        throw new Error('useSelect must be used within a SelectProvider');
    }

    window.select = context;

    return context;
}