Answers for "sleep isn't working reactjs"

2

sleep in react

sleep = (milliseconds) => {
        return new Promise(resolve => setTimeout(resolve, milliseconds))
    }
	
    componentDidUpdate(prevProps, prevState, snapshot) {
            this.sleep(5000).then(r => {
            // do something
      	    })
    }
Posted by: Guest on March-10-2021

Code answers related to "sleep isn't working reactjs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language