Loading tutorials
use, a function that reads a value from a resource during render. The resource is either a promise or a context. This chapter explains what use does, how it differs from Hooks you already know, and where it fits. Later chapters cover each part in detail.4 min readuse depends on it when it reads a promise. It assumes you can write function components, pass props, use useState and useContext, and read basic promise code. You do not need to have used Suspense before.3 min readuseState, and work with JavaScript promises and async functions. It also assumes you know that a Suspense boundary shows a fallback while something below it is not ready. Here you will use use to read the value of a promise3 min readuseState and useContext, and you know how promises and Suspense work at a basic level. It covers the rules for where use may appear in a component and why those rules differ from the rules for other Hooks.3 min readuseState and useContext, and what a context provider is. Earlier chapters covered reading promises with use and the rules for where use can be called. Here we apply those rules to context.3 min readuse read a promise inside a Suspense boundary. It covers what use does when a promise rejects and the two ways to respond: an error boundary or a fallback value.4 min readuse inside a Suspense boundary and know the basics of useState and props. It explains why the promise you pass to use must keep the same identity from one render to the next, and how to arrange that.3 min readuseState and useContext, JavaScript promises, and what a Suspense boundary does. It also assumes you have read how use unwraps a promise in a Client Component. Here you apply that to a framework that supports React Server Components,4 min readuseState and useContext, JavaScript promises and async functions, and what a Suspense boundary does. By now you have seen use read promises and context. The remaining question is which tool to pick in a given situation.3 min read