I did this in cDU all the time too though. Doesn’t seem different to me.
-
-
Replying to @ryanflorence @dan_abramov
I think people are just now doing these effects inside of components when before they did it in redux actions/middleware. As somebody who has been doing effects in components for a long time, passing that second argument to me feels much better than doing my own diff in cDU
1 reply 0 retweets 21 likes -
This Tweet is unavailable.
-
Replying to @jamiebuilds @dan_abramov
Just looked at the dozen or so real world hooks I’ve made and all but one uses the second arg. I’d be fine with changing the order, but I don’t think it’s a big deal either.
2 replies 1 retweet 5 likes -
This Tweet is unavailable.
-
Replying to @jamiebuilds @ryanflorence
Mistake as in “doesn’t work” or “perf could be better”?
2 replies 0 retweets 1 like -
My concern with putting it first is that people will always write [] “by default” and stumble into stale closure bugs because they don’t understand closures.
7 replies 0 retweets 6 likes -
This Tweet is unavailable.
-
This look pretty nasty to me. Why doesn't useEffect just always enforce an array to memoize? Then useEffectOnce is just const useEffectOnce = (callback) => useEffect(callback, []); Now the code is actually a lot more clear and it's hard to shoot yourself in the foot.
2 replies 0 retweets 4 likes -
Replying to @sebmck @jamiebuilds and
I once suggested useEffect(callback, [“once”]) half trolling but this kind of pattern was common in jQuery/MooTools era. :)
1 reply 0 retweets 7 likes
MooReact or ReactTools needs to happen.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 