schiehll / react-alert

alerts for React
MIT License
608 stars 98 forks source link

replaced useMemo with useCallback #162

Open sweeta-sinha opened 3 years ago

huan086 commented 3 years ago

The previous pull request broke the alert.alerts list.

This pull request changes the value returned from useAlert from an object to a function, which is unnecessary and should be a caller side decision.

The correct way is to destructure the value returned from useAlert and put the show/error function in the dependency list of useEffect or useCallback rather than the returned value itself.