fredwong-it
Published in

fredwong-it

Fred Wong
Fred Wong

Feb 4, 2021

·
1 min read

React — handle unmount event in useEffect hook

I need to have some clean up logic in the componentWillMount for the React life cycle, and I am wondering how can we do it through the react hook useEffect , and I find a good reference in here.

react hooks useEffect() cleanup for only componentWillUnmount?

Let me explain the result of this code for asking my issue easily.

stackoverflow.com

React
Useeffect

--

--

More from fredwong-it

Fred Wong’s tech blog

Read more from fredwong-it

Recommended from Medium

Piero Borrelli

Piero Borrelli

in

JavaScript in Plain English

4 Things Every Programmer Should Aspire to Be

Practicing DatScy

Practicing DatScy

Chess moves : random basic movements for the queen piece

Hugo Nteifeh

Hugo Nteifeh

in

Level Up Coding

Rosebox: CSS in Typescript

Firoz Kadri

Firoz Kadri

Top 10 Features for Angular JS 8

New top 10 feature for AngularJS 8
B. Chen

B. Chen

in

Level Up Coding

NPM CLI tricks to speed up your JavaScript development

Umar Taufiq

Umar Taufiq

in

ITNEXT

Laravel and Vue: Creating a Portfolio website with a CRUD admin panel — Chapter 18

Jayswilder

Jayswilder

Javascript 201

Ed Gonzalez

Ed Gonzalez

“1” + “2” = “12”

AboutHelpTermsPrivacy


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Get unlimited access
Fred Wong

Fred Wong

20 Followers

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech