is it a good practice to call a Lifecycle method inside another one ? #8806
sanba-anass
started this conversation in
General Discussions
Replies: 1 comment
-
onBeforeUnmount() would run anyway so there is no benefit in this arrangement other than creating a closure of let id;
onMounted(()=>{
id = increment()
})
onBeforeUnmount(()=> {
console.log("destroyed")
clearInterval(id);
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
onMounted(()=>{
let id = increment()
onBeforeUnmount(()=> {
console.log("destroyed")
clearInterval(id)
})
})
Beta Was this translation helpful? Give feedback.
All reactions