Twitter | Search | |
Dan Abramov
Working on . I explain with words and code.
64,688
Tweets
912
Following
197,971
Followers
Tweets
Dan Abramov 2h
Replying to @TheJutaz
In longer term we'll likely encourage error boundaries for both kinds of failures. Currently we're mostly using those for unexpected errors.
Reply Retweet Like
Dan Abramov 10h
Replying to @kryptos_rsa
The good form is to move it inside of useEffect if you only need it there. See here
Reply Retweet Like
Dan Abramov 10h
Replying to @kryptos_rsa
It lets you use a function that is known to not use any props/state itself.
Reply Retweet Like
Dan Abramov retweeted
Dan Abramov Jun 16
Replying to @dan_abramov
If you’re a React library author (components or Hooks), you might find it interesting to check whether your library works well with the new hot reloading approach. Most of what I test worked well. Instructions in the issue:
Reply Retweet Like
Dan Abramov 11h
Replying to @swyx @elijahmanor
I enjoy watching people do their thing well, whatever their thing is. If you know the answer for yourself, others’ advice may confuse you more than help.
Reply Retweet Like
Dan Abramov 11h
Replying to @maxizipitria
I don’t mean the actual thing they’re showing. I mean that having “connections” like this is how I mentally visualize values flowing in and out of Hooks.
Reply Retweet Like
Dan Abramov 11h
Reply Retweet Like
Dan Abramov 14h
Replying to @brendanrc2
I wouldn’t expect any issues.
Reply Retweet Like
Dan Abramov 14h
This is how I mentally visualize custom Hooks.
Reply Retweet Like
Dan Abramov 14h
Yeah that's the React one. Not sure why DevTools isn't showing up for you!
Reply Retweet Like
Dan Abramov 14h
Is this the version you're using?
Reply Retweet Like
Dan Abramov 14h
Replying to @raquelxmoss
Hmm that doesn’t sound expected. Any concrete example? Refs should work fine.
Reply Retweet Like
Dan Abramov 16h
Reply Retweet Like
Dan Abramov 16h
Replying to @joelmoss
You’re not the first person to ask this 🙂 Check the replies?
Reply Retweet Like
Dan Abramov 17h
Replying to @meafmira
Oh I guess the case where it breaks down is if the parent changes the Hook because then the call order can change. So.. yeah, don’t do it. 🙂 Treat Hooks as static.
Reply Retweet Like
Dan Abramov 17h
Not sure I understand the point you’re making. The PWA I’m aware of is the one made with React.
Reply Retweet Like
Dan Abramov 17h
Making it easier for a shallow compiler is another reason.
Reply Retweet Like
Dan Abramov 17h
It’s not Facebook (which isn’t even an SPA yet and doesn’t compile on developer machines at all). I just used an example that’s easy to understand.
Reply Retweet Like
Dan Abramov 17h
Replying to @meafmira
Nothing stops you but I’d avoid that. Too much indirection.
Reply Retweet Like
Dan Abramov 17h
Replying to @kentcdodds @PutziSan
Yeah. On the other hand you kinda have to learn this technique anyway at some point. In longer term the idea is that putting useMemo closer to usage can allow a compiler to insert it automatically.
Reply Retweet Like