I have been working on a project, and I want a div ID before unmounting it.
I tried using the below code:
useEffect(()=>
return()=>getId
),[state])
but the div was set to null before it came to useEffect.
To figure it out, I wrote an example code, and from that, I observed something really odd React is rendering component before it unmounts.
you can see similar behavior on clicking test button in above mention code.
If someone has any idea how it works, Please explain or suggest any alternate method.