JSerZANP / jser.dev-comment

1 stars 0 forks source link

react/2022/04/17/offscreen-component/ #12

Open utterances-bot opened 1 month ago

utterances-bot commented 1 month ago

How Suspense works internally in Concurrent Mode 2 - Offscreen component

Offscreen is component that has low priority in rendering, also used in Suspense

https://jser.dev/react/2022/04/17/offscreen-component/

EUNSUN23 commented 1 month ago

Thanks for qualified posts. I have a question about the part 'How Offscreen rendering is scheduled'. In most cases we don't use Offscreen alone. We use Suspense which updates the offscreen fiber's visibility props to 'hidden' and returns fallback fragment when it suspends. So It seems the 'updateOffscreenComponent' only runs when it's not suspending, where nextProps.mode is always 'visible'. In what cases does the branch(if('nextProps.mode === 'hidden'){...}) of 'updateOffscreenComponent' function runs?