mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
fix(SnackbarProvider): resolve context error
This commit is contained in:
1 parent
ce35041568
commit
9eefc1642a
2 files changed
+2
-4
No files matched your search
@@ -2,7 +2,7 @@ import React, { createContext, useState, useEffect, useRef } from 'react';
|
||||
import { IAlert } from '../hooks/useSnackbar';
|
||||
|
||||
|
||||
export const SnackbarContext = createContext({ addAlert: (a: IAlert) => {} });
|
||||
export const SnackbarContext = createContext(null);
|
||||
|
||||
function SnackbarProvider({ children }) {
|
||||
const [alert, setAlert] = useState(null);
|
||||
@@ -13,7 +13,7 @@ function SnackbarProvider({ children }) {
|
||||
clearTimeout(timer.current)
|
||||
timer.current = setTimeout(() => {
|
||||
setAlert(null)
|
||||
}, 2500);
|
||||
}, 1000);
|
||||
}
|
||||
return () => clearTimeout(timer.current)
|
||||
}, [alert]);
|
||||
|
||||
Reference in new issue
Block a user