Use React.useEffect() hook for both mount and unmount desired functionality implementation. If you leave the dependency array empty, that means the code inside will run only once, which replaces the class mount & unmount lifecycle hooks.
  • Component rendering
  • Component mounted