Is there plan to implement the react-core in C or other native language ? I can see that being compiled to webassembly for browsers and react-native can have multiple language support ?
Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
11–20 of 66 posts
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#12Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#13Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#14Earlier quoted context omitted.
Yep, nice link roundup - beat me to it :) Also see the summary post on the React blog for the key takeaways from the demo: https://reactjs.org/blog/2018/03/01/sneak-peek-beyond-react-...
Thanks for the link. But boy, the Apple presentation style is so heavy in that blog post. "We call this...", "We can't wait..."
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#15Maybe a dumb question or wrong forum. But how do you start using latest React in a project?
The current version of React is 16.2 (see release notes: https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-s... ). 16.3 is getting closer to release and will include several new aspects, such as revisions to the lifecycle methods and a simpler `createRef` API. The async stuff that was demoed today is likely to be in a 16.4 release later this year.
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#16So glad someone captured this talk! At the 15 minute mark, he introduces a new paradigm for asynchronous IO within render functions; see a screenshot here: https://www.dropbox.com/s/wybqgtftuyqipk8/Screenshot%202018-... . This is groundbreaking, to say the least, as previously this needed to be done by adding higher-order components to inject the result of the fetch as a prop at some higher level; now, it's as simple…
So I am guessing if a prop is `instanceof Promise` or some other constructor then it must trigger this response . . . is that correct?
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#17Is there plan to implement the react-core in C or other native language ? I can see that being compiled to webassembly for browsers and react-native can have multiple language support ?
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#18Earlier quoted context omitted.
So I am guessing if a prop is `instanceof Promise` or some other constructor then it must trigger this response . . . is that correct?
The key phrase is "thenable", which is a term for anything where `typeof variable.then === "function"` is true.
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#19Earlier quoted context omitted.
The key phrase is "thenable", which is a term for anything where `typeof variable.then === "function"` is true.
But only when passed to HTML elements I hope. Because say I have my own type of the shape `{ then(): Whatever }` and try to pass that as a prop to one of my components I don't want React to invoke that function.
Re: Beyond React 16 by Dan Ambramov – Async Rendering and React Suspense
#20So glad someone captured this talk! At the 15 minute mark, he introduces a new paradigm for asynchronous IO within render functions; see a screenshot here: https://www.dropbox.com/s/wybqgtftuyqipk8/Screenshot%202018-... . This is groundbreaking, to say the least, as previously this needed to be done by adding higher-order components to inject the result of the fetch as a prop at some higher level; now, it's as simple…
So I am guessing if a prop is `instanceof Promise` or some other constructor then it must trigger this response . . . is that correct?
What's happening instead is that imageFetcher.read() either returns a string OR throws a promise; it never returns a Promise.
So 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.