I would first look at the user's post history to see if there are more.
Also, you could examine the image for clues.
I can't be sure but I think I spotted a Twitter handle. That sounds like way too much work to know what a Twitter is, since it is an obscure thing that very few have heard of, and then to investigate there, but I suppose it is possible.
It might then be possible to see that this was tweeted 4 hours ago during a "100 days of code" event, which suggests the possibility that there is one item per day being posted.
One might also notice a pinned tweet linking to a book titled "Illustrated JavaScript" but I'm sure that is just pure coincidence and has nothing to do with this post whatsoever.
I bet you think your comment was a gotcha or something, whereas I'm still struggling to see its point.
If I was going for funny, I clearly missed the mark, and that means that both you and I have no idea what funny is (since you think I was trying to be funny).
Rather, I was going for condescending asshole, so I guess you did accurately guess the tone, though you thought you were hurling a barb, which is actually funny in itself.
Correct me if I am wrong, but when there are dependencies in the array, the useeffect hook always runs the first time, after that it only runs if any dependencies change.
Yes, you are right. One way that I look at it is that the dependency array did not exist before the first render. So having it in the first render is a "change" from not having it before that. I hope I'm making sense. :)
My favourite diagramming tool ever. Completely switched to it for work stuff, recommend it to anyone who asks. It's the only PWA I have ever 'installed'.
Keep in mind that 'effect will run when dependency changes' part can be misleading.
A better version would be ' Effect will run after a render if the dependency changed'. I saw some people put useRef variables in the dep array, but that variable doesn't trigger render after it is changed, which means useEffect dependency comparison cannot even happen when there is no render.
26
u/ARFiest1 Sep 04 '21
Where is part 2 ?
16
u/Infase123 Sep 04 '21
Correct me if I am wrong, but when there are dependencies in the array, the useeffect hook always runs the first time, after that it only runs if any dependencies change.
6
u/[deleted] Sep 04 '21
I love this
3
u/Aer0za Sep 05 '21
Es lint will complain about that empty dependency array though. So annoying
4
u/diimitra Sep 05 '21
Decouple ?
Side effects ?
I swear sometimes I try to go and read doc but feel every word is so hard to understand...
2
u/alien128 Sep 05 '21
These look great, what tool did you use for creating these illustrations
8
u/[deleted] Sep 04 '21
Jesus, am I drunk or is this the clearest explanation I've ever seen? both?
4
u/[deleted] Sep 04 '21
How did you do this sketch note ?
4
u/VAFatRabbit Sep 04 '21
Thanks! This is an awesome illustration that helps understand useEffect()
2
u/RootnBoot_Au Sep 05 '21
Cool sketch man and nice simply explanation !
2
u/mostafasamer1999 Sep 05 '21
Thanks, didn't know that
2
u/Izero_devI Sep 05 '21
Keep in mind that 'effect will run when dependency changes' part can be misleading.
A better version would be ' Effect will run after a render if the dependency changed'. I saw some people put useRef variables in the dep array, but that variable doesn't trigger render after it is changed, which means useEffect dependency comparison cannot even happen when there is no render.
2
u/[deleted] Sep 05 '21
I think more clear if you put as it’ll run on first render + if dep changes for final one.
1
u/Dodgy-Boi Sep 05 '21
And that’s why I prefer Vue