reactjs / react-gradual-upgrade-demo

Demonstration of how to gradually upgrade an app to a new version of React

Home Page:https://reactjs.org/blog/2020/08/10/react-v17-rc.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: why is this not using React.lazy?

hswolff opened this issue · comments

Hello!

I’ve read the README and it notes that this demo essentially re-creates the functionality of React.lazy but I can’t see any explanation as to why that is the case.

So...why is it so?

commented

React.lazy wouldn't work because we want the actual rendering to be done by the inner React but the waiting needs to be done by the outer React. There's just no way to express that via the lazy API.