useEffect | Does the clean-up return function gets called when leaving the page?
Answered
Virginia's Warbler posted this in #help-forum
Virginia's WarblerOP
With useEffect, does the clean-up return function gets called when leaving the page?
Answered by Mallow bee
yes, the first time the useEffect runs, its cleanup function gets stored. Then it will run that function either right before the effect runs next time, or when the component unmounts
1 Reply
Mallow bee
yes, the first time the useEffect runs, its cleanup function gets stored. Then it will run that function either right before the effect runs next time, or when the component unmounts
Answer