dmikester1D
Reactiflux3y ago
60 replies
dmikester1

✅ – ✅ – dmikester1 – 16-36 Sep 26

I have an
OutsideClickTrigger
hook I have found that I am utilizing to hide a filter menu whenever the user clicks outside the menu. There is a filters button that I am using to show the filters menu like this:
onClick={() => setShowFilters(!showFilters)}
. Now the issue is that when the filters menu is open, and I click on the filters button again to close it, it does not work or maybe it closes it quickly and then
OutsideClickTrigger
gets run and it shows it again. Last time I was able to fix this by wrapping the button and the menu in the hook component. That won't work this time because of the structure of my html. I'm thinking I somehow need to also pass the button element into that hook so it checks if that was the element clicked.
Was this page helpful?