useEffect(() => {
// I've initiated Calendly in this effect
}, [])
console.log(window.Calendly)
I got undefined when I print window.Calendly, but when I print just window, I got an object contains Calendly.
useEffect(() => {
// I've initiated Calendly in this effect
}, [])
console.log(window.Calendly)
I got undefined when I print window.Calendly, but when I print just window, I got an object contains Calendly.
Copyright © 2021 Jogjafile Inc.
Effects run after rendering. So you're logging first, and then setting up
window.Calendlylater.When you switch to logging
window, you're now logging an object. The developer tools do not evaluate what's in that object until you click to inspect it. So by the time you click,window.Calendlyexists, but it didn't exist when the log statement ran.