Skip to content

Conversation

@rwieruch
Copy link
Member

@rwieruch rwieruch commented Nov 1, 2018

Hooks Misconceptions:

  • clean up function runs not only for unmounting but also after each render
  • stale state is a thing with hooks too
@rwieruch rwieruch merged commit 83134cb into master Nov 1, 2018
);
}

return () => clearInterval(interval);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rwieruch , in case that isOn === false, this will do clearInterval(undefined). It doesn't break anything, but it would be IMHO nicer to only run clearInterval for isOn === true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants