Created
March 1, 2020 21:24
-
-
Save DZuz14/cc4bcd86581be72ebbe6d5ce8f2e3c78 to your computer and use it in GitHub Desktop.
useEffect on initial render in Slider
This file contains hidden or 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(() => { | |
const play = () => { | |
autoPlayRef.current() | |
} | |
const interval = setInterval(play, props.autoPlay * 1000) | |
return () => clearInterval(interval) | |
}, []) | |
...rest of Slider component |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment