reactjs/rfcs

useMount

kitten-s opened this issue · 3 comments

It will cool to add useMount hook that behaves as oncomponentdidmount. Because it is more simple to read than useEffect(fn, []);

You can build it on your own.

function useMount(mount) {
  React.useEffect(mount, []);
}

@kitten-s , you can use this npm pkg (use-lifecycle-hooks), if this approach it's more comfortable for you.

Hi, thanks for your suggestion. RFCs should be submitted as pull requests, not issues. I will close this issue but feel free to resubmit in the PR format.