2 Matching Annotations
  1. Mar 2023
    1. Suspense itself will show fallbacks when not ready and reveal the contents when promises resolve, problem is that if there are multiple Suspense components, it could lead to flickering because of the order is not assured, that’s why we need sorta coordinating. SuspenseList is exactly for this.



      <React.SuspenseList revealOrder="forwards"> <React.Suspense fallback={\<p>loading...\

      }> <Child resource={resource1} /> </React.Suspense> <React.Suspense fallback={\<p>loading...\

      }> <Child resource={resource2} /> </React.Suspense> <React.Suspense fallback={\<p>loading...\

      }> <Child resource={resource3} /> </React.Suspense> </React.SuspenseList> ```

      We can see that the revealing order is kept, from top to bottom, even though the 2nd promise if fulfilled sooner.