10 Using third-party hooks

This chapter covers

  • Making the most of third-party hooks
  • Accessing state in the URL with React Router’s useParams and useSearchParams hooks
  • Switching to a new route with React Router’s useNavigate hook
  • Efficiently fetching and caching data with React Query’s useQuery hook
  • Updating data on the server with React Query’s useMutation hook

Chapter 9 introduced custom hooks as a way to extract functionality from components, making the functionality reusable and simplifying the components. Custom hooks provide a simple, readable way to access all kinds of functionality from a function component, whether that’s simple tasks like changing the document title or managing a state value with local storage, or increasingly complex ...

Get React Hooks in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.