Twitter | Search | |
Dan Abramov
Working on . I explain with words and code.
59,907
Tweets
874
Following
175,095
Followers
Tweets
Dan Abramov 19m
Replying to @j_schwartzz
You have a good hunch code like this tends to have race conditions. However code like this in classes usually has exactly the same race conditions. Just more noticeable in Hooks :-) If you can't cancel, at least you might wanna track isCancelled and not setState if it is.
Reply Retweet Like
Dan Abramov 40m
Replying to @j_schwartzz
I don’t think the async logic is significantly different from how you’d do it in a class?
Reply Retweet Like
Dan Abramov 2h
Replying to @ryanflorence @mbrevda
Also intermediate renders get batched. So you’re risking your effect getting skipped in between.
Reply Retweet Like
Dan Abramov 2h
Thanks Rick! I don’t like to see the collective pile-on in the neighbouring threads btw. I appreciate your work and understand the frustration when things seemed clear but aren’t quite yet.
Reply Retweet Like
Dan Abramov 3h
Replying to @drboolean
I’ve definitely seen its unquestioned usage cause perf problems in open source components. Not even reduce per se but allocating a new or object for every iteration for hundreds of keys.
Reply Retweet Like
Dan Abramov 3h
Replying to @RyanTomczik @tpolecat
I’m not taking about monads, only AE. But yeah this is probably close in spirit. I’m sorry I’m not well-versed in theory and can’t speak with precision.
Reply Retweet Like
Dan Abramov 3h
Replying to @drboolean
Imo stuff that’s spread through time and space matters. The flow of your program. That’s where FP pays off. Now, writing loops... focusing on that doesn’t win you much. I always go for whatever reads easier. Whichever approach I pick, its downstream effects are tightly scoped.
Reply Retweet Like
Dan Abramov 4h
Replying to @drboolean
There’s another side to this. Which is — spending too much focus on avoiding local mutation is how we alienate people who don’t find this readable. I find functional *architecture* way more valuable to teach. But the message gets lost in dogma.
Reply Retweet Like
Dan Abramov 4h
Replying to @RyanTomczik @tpolecat
The implementation detail is it’s a side effect (specifically, global mutation). But I’m just saying it doesn’t have to be. You could express the same with AE without a global mutation if we had them in JS.
Reply Retweet Like
Dan Abramov 4h
Replying to @RyanTomczik @tpolecat
We might eventually expose it as a first-class API. I don’t know. But that’s how different renderers are able to handle useState and useEffect in different ways. (For example, useEffect is noop on the server.)
Reply Retweet Like
Dan Abramov 4h
Replying to @RyanTomczik @tpolecat
You can think of React as being the handler. The need to compose them is rare enough in React that it’s not exposed directly although it is possible by swapping out the dispatcher and then restoring it.
Reply Retweet Like
Dan Abramov 4h
Replying to @bencotte
I just listened to A Violent Noise six times in a row so yes
Reply Retweet Like
Dan Abramov 4h
Replying to @astralwave @qoouep
Shiiit I guess I’ll have to buy B&W again. Somebody stole mine once.
Reply Retweet Like
Dan Abramov retweeted
Jason Lengstorf 4h
This is a periodic reminder: open source maintainers are doing their best to keep up with a firehose of questions, bugs, imperfect docs, and so many other tasks it's easy to take for granted. Please thank and be kind to OSS maintainers. Usually they only hear the bad feedback.
Reply Retweet Like
Dan Abramov retweeted
Sara Soueidan 24h
I’ll try this one more time: just because a tool is popular or has worked for you does not mean it’s the way to go for everyone. Using a popular tool doesn’t automatically make u superior. & Just cz others have opinions unlike urs doesn’t mean they need to be convinced to change.
Reply Retweet Like
Dan Abramov 4h
Replying to @qoouep
Not really but I still dig it
Reply Retweet Like
Dan Abramov 4h
Wow this album is so much more interesting to listen to after I grew out of only hearing lyrics and guitar sounds
Reply Retweet Like
Dan Abramov 4h
No but I think we should add it. Maybe to this page?
Reply Retweet Like
Dan Abramov 5h
Thank you. I can understand the frustration.
Reply Retweet Like
Dan Abramov 5h
Replying to @SaraSoueidan
It’s quite sad when that happens. I want to emphasize those people don’t represent the React community. The idea of there being a “one true solution” is completely antithetical to everything React stood for. If anyone sees vitriol coming from React contrbutors, please report it.
Reply Retweet Like