News for hackers. Stuff that matters.
Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by btown on Thursday March 01, 2018 @02:28PM (#16495296)
React isn't changing any logic of the types of props; if you actually pass a Promise as a prop, it will be treated 100% as it was in previous React versions.

What's happening instead is that imageFetcher.read() either returns a string OR throws a promise; it never returns a Promise.

So <Component foo={fooFetcher.read(...)} /> either gets instantiated with the fetched Foo, or throws so React.createElement(Component, ...) never gets called in the first place.

Only if you physically throw a Promise (or "thenable") does the new logic apply: https://github.com/facebook/react/pull/12279/files#diff-1996... is called inside an exception handler.

Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by pault on Thursday March 01, 2018 @03:38PM (#16496036)
Wow, I never would have considered throwing anything other than an Error. On the face of it, this seems like an incredibly powerful technique, but is it an abuse of a language feature?
Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by riquito on Thursday March 01, 2018 @03:51PM (#16496194)
Is a feature of the exceptions to let you handle exceptional cases far away from the caller, up in the stack.

You should keep a distinction between exceptions that means "error" and exceptions that means "some kind of event happened", and handle them accordingly.

Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by btown on Friday March 02, 2018 @01:19AM (#16499526)
Python “abuses” exceptions in a similar way every time you iterate over a generator: https://softwareengineering.stackexchange.com/questions/1124...

At the end of the day it’s just a control flow mechanism. And theoretically, if you lack data needed to render, it’s an exceptional condition.

Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by pault on Saturday March 03, 2018 @02:46PM (#16511167)
It's a very interesting technique; I will definitely be keeping an eye out for appropriate use cases.
Re:Beyond React 16 by Dan Ambramov – Async Rendering and Rea... by acjohnson55 on Thursday March 01, 2018 @11:17PM (#16498973)
My guess is that it won't catch on in the long run. But, you never know.