import { createContext, useContext } from 'react';

const MessageContext = createContext(undefined);
const useMessageContext = () => {
    const context = useContext(MessageContext);
    if (!context) {
        throw new Error('Message compound components must be used within <Message>');
    }
    return context;
};

export { MessageContext, useMessageContext };
