everweij / react-laag

Hooks to build things like tooltips, dropdown menu's and popovers in React
https://www.react-laag.com
MIT License
907 stars 47 forks source link

Fix "useOutsideClick" dep array. #39

Closed exihuatl closed 4 years ago

exihuatl commented 4 years ago

This PR fixes a problem, where onOutsideClick callback doesn't have access to correct state / props values when changes happen while layer is open.

I've created a simple example representing the issue: https://codesandbox.io/s/kind-elgamal-0njqm

everweij commented 4 years ago

Thanks for this PR @exihuatl ! This fix is in the 1.7.3 release.