if (!data) {
  throw fetch()
}

Suspense는 던져진 promise를 캐치해서 resolve될 때까지 fallback을 렌더하고, resolve되면 다시 렌더한다. 던지는 건 예외와 같은 메커니즘이다.

위 throw fetch() 는 렌더할 때마다 새 promise 를 던진다. 공식 경로는 캐시된 promise 를 use 로 읽는 것이다.1


Footnotes

  1. – React: “Without a framework, you can read a Promise with use directly, as long as the Promise is cached so the same instance is reused across renders.” ↩

`#307`