Created
December 22, 2020 15:03
-
-
Save MustSeeMelons/2fef47db055637f56c396ef962b50d75 to your computer and use it in GitHub Desktop.
Show The Logs Harold - Listen for element change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useEffect(() => { | |
if (activeFilterElement !== 0) { | |
setActiveFilterElement(0); | |
const hasElements = | |
refStore[REF_KEY.FILTER_ELEMENTS] && | |
(refStore[REF_KEY.FILTER_ELEMENTS] as HTMLElement[]).length > 0; | |
hasElements && | |
(refStore[REF_KEY.FILTER_ELEMENTS][0] as HTMLElement).scrollIntoView({ | |
behavior: "smooth", | |
}); | |
} | |
}, [props.filterElementsUpdate]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment