MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ToastContainer

Function ToastContainer

packages/react-aria/stories/toast/Example.tsx:21–32  ·  view source on GitHub ↗
({
  children,
  ...otherProps
}: ToastStateProps & {children: (state: ToastState<string>) => React.ReactNode})

Source from the content-addressed store, hash-verified

19const ToastContext = createContext<ToastState<string> | null>(null);
20
21export function ToastContainer({
22 children,
23 ...otherProps
24}: ToastStateProps & {children: (state: ToastState<string>) => React.ReactNode}): JSX.Element {
25 let state = useToastState<string>(otherProps);
26 return (
27 <ToastContext.Provider value={state}>
28 {children(state)}
29 <ToastRegion />
30 </ToastContext.Provider>
31 );
32}
33
34function ToastRegion() {
35 let state = useContext(ToastContext)!;

Callers

nothing calls this directly

Calls 2

useToastStateFunction · 0.90
childrenFunction · 0.85

Tested by

no test coverage detected