Reactjs : Dumb mistakes I did as a junior developer #shorts

preview_player
Показать описание
So lets say you are loading an external script GTM/GA and you want to
fire an event as soon as it loads. I used to make this dumb mistake of
delaying this event by some amount of time using setTimeout, hoping
that it gets loaded. Instead we should setInterval & clearInterval to
make it work perfectly

Here in this example my GTM script loads after 5 seconds
and event gets fired after 8 seconds but there is a good probability
that script doesnt load and and my timeout gets fired
#code #developer #js #react #nextjs #javascript #ecmascript6 #ecmascript
#html #css #reactjs
Рекомендации по теме
welcome to shbcf.ru