Twitter | Search | |
James Long 1 Mar 18
I love experimenting with new APIs, but with the new React async render stuff, I'm not sure what the original problem is. IO-bound stuff doesn't block the UI. Can't this stuff be implement in userland with render props (with more verbose api)?
Reply Retweet Like
James Long 1 Mar 18
Replying to @dan_abramov
you mentioned "blocking the UI" in the IO-bound demo, what did you mean by that? (This is by no means a criticism of the API, I'm 99% sure this is going to be awesome, I'm just thinking through it)
Reply Retweet Like
Dan Abramov 1 Mar 18
Replying to @jlongster
This way if the network is fast, I don’t have appearing and disappearing spinners everywhere. In fact I can render the loading spinner on my *old* tree while my *new* tree is being prepared.
Reply Retweet Like
James Long 1 Mar 18
Replying to @dan_abramov
I think *technically* you could do these workflows via context, right? But the problem is they would be much more difficult to setup, maintain, and things would probably end up implement logic in the wrong place
Reply Retweet Like
Sebastian Markbåge 1 Mar 18
Replying to @jlongster @dan_abramov
You need to duplicate the render logic of the tree, and even then you wouldn't have access to the state. So you'd have to replicate the state logic, which is basically React.
Reply Retweet Like
Sebastian Markbåge 1 Mar 18
Replying to @jlongster @dan_abramov
My mental model is that you can just do all of this with pure functions. React just gets in the way, and we fixed that. :)
Reply Retweet Like
James Long 1 Mar 18
I love ignore the async-ness of promises. I'm just trying to understand how I'd try to implement this without a new API and the problems I'd hit because that's how I learn new stuff.
Reply Retweet Like
Sebastian Markbåge 1 Mar 18
Replying to @jlongster @dan_abramov
You can't do it on top of React. That's why new primitives are needed. You can build a pseudo-React though. Is that enough?
Reply Retweet Like
James Long 1 Mar 18
See this thread: Sure, much hackier, but that's the contrast I was going after. I look forward to playing with the new API
Reply Retweet Like
Sanket Sahu ⚡ 1 Mar 18
I'm not sure if pure render functions are pure anymore with this intermediate cache layer and throwing of Promises.
Reply Retweet Like
James Long 1 Mar 18
"Pure" is a vague term. Are you saying that any functions that can throw exceptions aren't pure? Because those are basically all functions in JS
Reply Retweet Like
Sanket Sahu ⚡ 1 Mar 18
Actually, yes! If the function behaves differently with the exact same arguments then it's certainly not pure.
Reply Retweet Like
Sebastian Markbåge
You can pretend it does an algebraic effect behind the scenes. That's how we conceptualize it.
Reply Retweet Like More