I recently started using react so I apologize if this is too "noobish" question. So I am trying to have a SweetAlert popup on path(URL) change is there a way this can be done using functional component?
I already checked Callback when DOM is loaded in react.js But this works only for class components..
This is possible using useEffect()
hook.
If you’re familiar with React class lifecycle methods, you can think of
useEffect
Hook ascomponentDidMount
,componentDidUpdate
, andcomponentWillUnmount
combined.
Since hooks can only be called within functional components.