Loading tutorials
useEffect necessary: a component's render must be a pure calculation. You will see what purity means in React, how the render and commit phases differ, which mistakes break purity, and how to fix them.6 min readuseState. It also assumes you know that a state change makes React call your component again, and that you are comfortable with closures, Promises and fetch. You don't need to know useEffect yet. The next chapters introduc6 min readuseState and understand that a state change triggers a re-render. You should also be comfortable with JavaScript closures and with reading the browser DOM. The previous chapters covered pure rendering and what counts5 min readuseState, closures, and how a state change causes a re-render. It also assumes you have seen a basic useEffect call. Here you learn how the dependency array decides when an effect runs again, and which mistakes come up most often.5 min readuseState, closures, and how useEffect and its dependency array decide when an effect runs. It covers the cleanup function: what it is, when React calls it, and the mistakes that cause leaks and stale results.5 min readuseState, closures, and the basic useEffect syntax and dependency array from earlier chapters. It also assumes you know that an effect can return a cle6 min readuseState, closures, Promises, and the browser fetch API. You should also know how the dependency array and cleanup functions work from the previous chapters.6 min readuseState, and that you know the useEffect basics from earlier chapters: the dependency array, cleanup, and the fact that effects run after render. Here you learn how to decide where a piece of logic belongs.5 min readuseState, and read a useEffect call with its dependency array and cleanup function. It also assumes you know that React calls your component to render, then commits the result to the DOM.5 min readuseState, the dependency array, and cleanup functions from the earlier chapters. It covers one failure that appears when those pieces interact: an effect that keeps reading old values.5 min readuseState, closures, and how the dependency array decides when an effect re-runs. You should also be comfortable with the idea that every render creates a fresh set of local variables.5 min readuseEffect syntax, the dependency array, and cleanup functions from the earlier chapters. You should also be comfortable with closures and with how React renders and commits.5 min readuseState, useEffect, dependency arrays and cleanup functions. You should also know how to fetch data in an effect and abort it on cleanup. This chapter shows how to move that code out of components and into reusable functions called custom hooks.5 min readuseEffect with dependencies and cleanup. It also assumes you know how stale closures and unstable dependencies arise, and that you have an ESLint setup in your project. Here you will use the Hooks lint rules as a diagnostic tool, then learn how to find out why an4 min readuseState, the dependency array, cleanup functions, and how a stale closure captures old values. If any of those are unclear, review the chapters on dependencies and stale closures first.7 min readuseEffect, dependency arrays and cleanup functions from the earlier chapters. It also assumes you know the render and commit cycle. Here you will learn the one hook that runs at a different moment than useEffect. You will also learn the narrow set of cases where tha5 min read