UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 457 B
import{jsx as p,jsxs as d}from"react/jsx-runtime";import{useState as l}from"react";import{ToastContainer as m}from"./ToastContainer";import{ToastContext as c}from"./ToastContext";export const ToastProvider=({children:r})=>{const[a,e]=l([]),n=o=>{e(s=>{const t=[...s];return t.splice(o,1),t})},i={open:(o,s)=>{e(t=>[...t,{message:o,duration:s}])}};return d(c.Provider,{value:i,children:[p(m,{toasts:a,handleToastClose:n}),r]})};export default ToastProvider;