
You'll find all example apps in the attached ZIP file.
Building a simple counter app is the best way to understand the basics of custom hooks.
useToggle is a standard custom hook in many React web applications. We'll see how we can build our own!
In this lecture, we'll recreate a popular custom hook: useFetch. We'll create a simple weather dashboard to demonstrate fetching data from an API using this hook.
In this lecture, we'll learn how to reuse custom hooks across multiple React components and sync component states with localStorage using a custom hook!
We've all been missing those Dark themes! Let's build a custom hook for a theme switcher button!
Learn to clean up your code full of useReducer dispatch actions by encapsulating them in a custom hook for managing business logic.
Testing code that's reused between several components is super important. Learn how to test custom hooks using the React Testing Library.
In this course, through 6 small applications, we'll recreate hooks and patterns that are commonly used in production web applications.
We'll learn how to encapsulate generic utility functions, fetches, business logic, or any code we want to reuse in Custom Hooks.
We'll use create-react-app as the starting port for every application, React 18 and TypeScript.
The lectures will cover:
Introduction to Custom Hooks (Counter app)
Structure of a Custom Hook (Toggle component)
Lifecycle in Custom Hooks (Weather dashboard)
Sharing Logic with Custom Hooks (useForm hook + localStorage)
Custom Hooks with Context API (Theme Switcher)
Advanced Patterns and Best Practices (Todo app)
Testing Custom Hooks (Counter app tests)
This course aims to show you different types of Custom React Hooks in various scenarios so you can learn, recognize, and apply these patterns to your application.
Working Through This Course
Every example app is built with Create React App. This was the easiest way for me to create React apps I can work with that don't have any unnecessary clutter, but these patterns can be applied in any React application, no matter how they are created.
This course is broken down into lectures and in each lecture you'll build a different app, and in some you'll even reuse some of the hooks you created earlier. The course is a practical, hands-on approach to learning through practice. You learn best when you code along with the examples.
Resources
All example apps are in custom-react-hooks-course Zip, In Lecture 1. > Introduction.