react-pirate
react-pirate copied to clipboard
fix(useUnmount): use a memoized function
Because of the use of the [] cache, only the first function that was passed in would have been used during the unmount process. This ensures that the most recent render's fn will be used on the final unmount.
The same consideration does not need to be taken for useMount.
Ok so I get the problem and was able to reproduce it although your solution doesn't seem to work either ? Here's a small sandbox with the test : https://codesandbox.io/s/71pxo9nkzx
Am I missing something ?