useAlert hook to display success and danger snackbars. The alert message disappears after 5 seconds or if the user closes the alert message.
Changes
Added an AlertProvider component that provides a useAlert() hook which uses react context under the hood. The hook returns a function alertUser(message,type) which accepts message and type as parameters.
Implementation
The alertUser() is implemented in Pages>Home>index.jsx at line 80 and 88. Other Alerts can be changed to use hooks as well (will do it after the code is reviewed).
References to the issues
157
155
154
Description
useAlert hook to display success and danger snackbars. The alert message disappears after 5 seconds or if the user closes the alert message.
Changes
Added an AlertProvider component that provides a useAlert() hook which uses react context under the hood. The hook returns a function alertUser(message,type) which accepts message and type as parameters.
Implementation
The alertUser() is implemented in Pages>Home>index.jsx at line 80 and 88. Other Alerts can be changed to use hooks as well (will do it after the code is reviewed).
https://user-images.githubusercontent.com/83173777/158048302-0c07cea4-b10c-4468-8f71-c626625ddf1a.mp4