UNPKG

mui-alert-provider

Version:

Make your alerts float! A lightweight provider for Material UI’s Alert that fits seamlessly into any web UI.

11 lines (10 loc) 303 B
import { useContext } from "react"; import { AlertContext } from "./AlertProvider"; const useAlert = () => { const context = useContext(AlertContext); if (!context) { throw new Error("useAlert must be used within an AlertProvider"); } return context; }; export default useAlert;