if (condition) {
return <A />
} else {
return <B />
}
I can be confident the UI is consistent with my state. React guarantees it. If condition is true, I'll see A, otherwise I'll see B. I won't see something broken in between. That's the whole point.
if (condition) {
return <A /> // what if something inside takes too long
} else {
return <B />
}
So do we sacrifice consistency? No.
function A() {
<div>
<h1>Show me immediately</h1>
<Suspense fallback={<Spinner />}>
<ThisTakesTooLong />
</Suspense>
</div>
}
It lets React "cut off" slow parts in order to stay consistent.