Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

componentwillunmount hooks

useEffect(() => {
  window.addEventListener('mousemove', () => {});

  // returned function will be called on component unmount 
  return () => {
    window.removeEventListener('mousemove', () => {})
  }
}, [])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #componentwillunmount #hooks
ADD COMMENT
Topic
Name
2+8 =