Loading tutorials
useState and useEffect, and that you are comfortable with arrow functions, destructuring and closures.2 min readuse and that calls other hooks inside its body. This chapter covers what that definition means, why the naming convention matters, and how a hook differs from a component and from a plain function.2 min readuseState, and the Rules of Hooks from earlier in the tutorial. You should also be comfortable with useCallback and arrow functions.2 min readuseState, function components, and how to call a custom hook such as useToggle. It explains why two components, or two calls in one component, never share state through a hook.2 min readuseState, the Rules of Hooks, and how to extract logic into a hook such as useToggle. A hook is a function, so its parameters and return value are its public API. Callers depend on that API, so it is worth designing on purpose.2 min readuseState, the basics of useEffect, closures, and the Rules of Hooks. It covers how an effect lives inside a custom hook and why its cleanup function matters.2 min readuseState and useEffect basics, closures, and the Rules of Hooks. It covers how the dependency array decides when an effect re-runs, and the errors that come from getting it wrong.3 min readuseState and useEffect, closures, and the Rules of Hooks. It also assumes you have written a small custom hook such as useToggle.2 min readuseState and useEffect, can read promise chains, and have read the earlier chapters on effect cleanup and dependency arrays.2 min readuseState, useEffect with cleanup, useCallback, closures, and how dependency arrays decide when an effect re-runs. Earlier chapters covered these.2 min readuseState, useEffect with cleanup, and how a custom hook returns values to a component. It covers reading data that lives outside React, such as the browser's online status, matchMedia, or a store you wrote yourself.2 min readuseState and useEffect, and that you know the Rules of Hooks. It also assumes you have seen useDebouncedValue and useFetchJson from earlier chapters.2 min readuseState and useEffect, and that you have used Jest or Vitest with React Testing Library. Here you will test hooks directly, without building a throwaway component for each test.2 min readuseState, useCallback, and the basics of TypeScript: type annotations, generics, and tuples. You have already written hooks such as useToggle in JavaScript. Here you add types so that callers get accurate autocomplete and errors.2 min readuseState, useEffect, and how closures capture values. It covers the mistakes that appear most often in custom hooks. It also gives a test for deciding whether you need a hook at all.2 min read