Last active
October 11, 2020 07:30
-
-
Save ravewebdev/79f363b68918de7d498a0f4385312e52 to your computer and use it in GitHub Desktop.
4.1. Handle Component State
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
const FrontendTracker = ( props ) => { | |
// Add the following before the `return()` block from Part 1, step 2.1. | |
const [ isLoading, setLoading ] = useState( false ); | |
const [ notice, setNotice ] = useState( null ); | |
useEffect( () => { | |
if ( null === notice ) { | |
return; | |
} | |
const timer = setTimeout( () => { | |
setNotice( null ); | |
}, 60000 ); | |
return () => clearTimeout( timer ); | |
}, [ notice ] ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment